Custom domain names

API Gateway generates random domain names for our applications:


It is possible to replace those URLs by a custom domain.

These guides assume you already own the domain name you will want to use.

Custom domains for HTTP lambdas

The first thing to do is register the domain in ACM (AWS Certificate Manager) to get a HTTPS certificate. This step is not optional.

  • open this link or manually go in the ACM Console and click "Request a new certificate" in the us-east-1 region (the region used for global "edge" certificates)
  • add your domain name and click "Next"
  • choose the domain validation of your choice
    • domain validation will require you to add CNAME entries to your DNS configuration
    • email validation will require you to click a link you will receive in an email sent to

After validating the domain and the certificate we can now link the custom domain to our application via API Gateway.

  • open API Gateway's "Custom Domain" configuration
  • switch to the region of your application
  • click "Create"
  • enter your domain name, select the certificate you created above and save
  • edit the domain that was created
  • click "Configure API mappings" to add an "API mapping": select your application and the $default stage (or dev in some cases), for example:

  • after saving the "API mappings", find the API Gateway domain name in the "Configurations" tab
  • create a CNAME entry in your DNS to point your domain name to this domain

After waiting for the DNS change to propagate (sometimes up to several hours) your website is now accessible via your custom domain.

You can also take a look at the plugin serverless-domain-manager.
It handles the custom domain creation and optionally adds the Route53 record if asked. It is still necessary to create the ACM certificate manually.

A basic implementation is proposed here :

Custom domains for static files on S3

Some applications serve static files hosted on AWS S3. You can read the Websites documentation to learn more.

The S3 bucket can be accessed at this URL: https://<bucket> (supports both HTTP and HTTPS).

To use a custom domain for a S3 static website the process lies in 2 steps:

  • name the S3 bucket like the wanted domain name

    For example for the website, the S3 bucket has to be named

  • point the domain to the S3 URL via DNS

    In our example the DNS entry to create would be a CNAME for pointing to

Static websites

If you are hosting a full static website with HTML files (per this documentation), the URLs to use will be different:

# or

In that case you need to use the domains above for the CNAME.

Note that the URL is HTTP-only and depends on the region.

To add HTTPS to your website for free it is possible to use a CDN like CloudFlare (simplest) or AWS CloudFront.