Custom domain for different stages

I have an app that is using a custom domain with wildcards.
For prod I want to use
For dev I want to use

How do I set that up in my serverless.yml file so when I deploy I get the mappings?
I’ve managed to set it up manually in API Gateway

1 Like

Did you ever get a solution to this?

Nope. Tried adding multiple entries but serverless didn’t like that.

I have a setup like this using the plugin:

  1. In my case the DNS names and SSL certificates are not managed via serverless, so this presupposes that they already exist in Route 53 and Certificate Manager

  2. Setup config file with stage specific values:

  certificateName: '*'

  certificateName: '*'
  1. Add custom section to serverless.yml:
  stage: ${opt:stage, self:provider.stage}
  stageConfig: ${file(<path to config file in step 2>):${self:custom.stage}}
    domainName: ${self:custom.stageConfig.domainName}
    certificateName: ${self:custom.stageConfig.certificateName}
    stage: ${self:custom.stage}
    basePath: <whatever you need this to be>
    createRoute53Record: false

Hope that helps!