How to setup a custom domain name with AWS API Gateway


When you configure an AWS API Gateway instance with one or more routes, AWS provides a custom domain name in the form of * In this tutorial you will learn one way to use your own domain name with API Gateway.

I assume you have a basic knowledge of how API Gateway works. I’m also using HTTP API with a Lambda function as a backend integration in this example, and the steps described here should be similar for different types of APIs. You also need access to your DNS registrar to update some records.

Step 1 — Disable the default endpoint

In API Gateway console, choose the API you want to update and click Edit. Under the Default endpoint section, choose Disabled and then Save. This option prevents users to access the API using the default (AWS generated) endpoint.

AWS API Gateway default endpoint

Step 2 — Request a certificate for the domain

AWS needs to verify you own the domain name you’re setting up. Go to Certificate manager console and click Request a certificate. For Domain name, enter the domain name you will use, for example and click Next. Choose the DNS validation method, skip the steps 3 and 4. Now use the data provided to update your DNS records and wait a few minutes for the validation status to become Issued.

Keep in mind that the AWS issued certificate will be valid as long as the records exist with the DNS registrar.

Step 3 — Add a custom domain name to API Gateway

Go back to API Gateway console. Under the Custom domain names section, click Create.

For Domain name, enter the domain name.
For ACM certificate, choose the certificate created in step 2.

AWS API Gateway — Create a domain

Step 4 — Map the domain name to a stage

Select the domain created in step 3. Under API Mappings section, click Configure API mappings.

For API, select the API instance.
For Stage, select the stage if any, or $default.
Click Save.

AWS API Gateway — configure API mappings

Step 5 — Configure Route 53

You need to match your domain name certificate with AWS in order to use SSL/TLS. Open the Route 53 console and under the Hosted zones section, click Create hosted zone.

For Domain name, enter your domain name. Keep the default options and click Create hosted zone.

AWS Route 53 — Create hosted zone

AWS provides you with some NS records. Add those records to your DNS registrar. Then, back in Route 53, click Create Record.

Keep the record name empty. The record type is A. For Value, activate the Alias toggle. Select Alias to API Gateway, the region and the endpoint. Click Create Records.

AWS Route 53 — Create A record

You’re all set. You may wait a few minutes for the records to become available. Then you can access the API Gateway instance using the new domain name.




Full-stack developer based in Quebec city, QC. I enjoy coding, data analysis, tennis and photography (

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Fixing that sneaky footer

2019: I was Naive

2019: I was Naive

Hawk Network’s Month of April Achievements🔥

Hiring a Golang Developer: Everything You Need to Know

Super simple AWS Kinesis data streams client in Python

Java equality, autoboxing and unboxing pitfalls

Understanding RxPHP Schedulers (part 2)

How we migrated the Wonder codebase to a monorepo in a snap

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Marius Bio

Marius Bio

Full-stack developer based in Quebec city, QC. I enjoy coding, data analysis, tennis and photography (

More from Medium

Migrating Legacy APP to AWS

Securely Access Your AWS Resources From Github Actions

Integrate OPA with Terraform to Restrict instances with unapproved AMIs on Styra DAS

Implementing trust for your enterprise API’s