Is custom base domain possible yet? (Feb 2017)

Can we make a custom domain yet for our API Gateway functions in any format?

  • https:// serverless_path
  • https:// random / serverless_path
  • https:// fixed / random / serverless_path
  • https:// serverless_path
  • https:// random / serverless_path
  • https:// fixed / random / serverless_path

Spaces added to prevent links in markup.

fixed means something the developer picked.
random means the random code given by default when making a APIG endpoint
serverless_path means the path picked by the developer for the APIG endpoint


All of this can be done, but not directly within serverless. You can put a CloudFront distribution in front of your serverless applications, which itself, can have a Route 53 domain alias. This would give you the subdomain for your API’s that you are looking for as well as the ability to have multiple serverless definitions (API Gateway definitions) within the same domain.

Not sure when/if CloudFront definitions will come to serverless. There is a limitation on being able to supply your own SSL for a CloudFormation defined CloudFront definition, IIRC and there may be other limitations as well making it better to define this manually rather than through configurations. However, that is just a guess.


To follow up this article was written recently to describe how to set it up directly with serverless, in much more detilal.

This plugin has also been created since then.

1 Like

Another option: serverless-domain-manager plugin
I’m using this one in my project and it’s worked well. Handles creation of the Route53 record as well as variable basePath by stage.

Here’s the relevant section from my serverless.yml

  - serverless-domain-manager

  default_stage: jack
  stage: ${opt:stage, self:custom.default_stage}
    basePath: ${self:custom.stage}
    stage: ${self:custom.stage}
    createRoute53Record: true

Hope it helps.