Connecting Your Domain to AWS API Gateway: A Step-by-Step Guide

Paul Allies
3 min readApr 14, 2024

--

You’ve built an API on AWS using API Gateway, and now you’re ready to direct your domain to this API instead of relying on the default AWS-issued one, which typically looks like this.

https://abcdefghij.execute-api.us-east-1.amazonaws.com

Step 1: Register a domain

If you haven’t already, you’ll need to register a domain through a domain registrar GoDaddy. Once you’ve registered your domain name, you’ll have ownership and control over it.

Step 2: Request a Certificate

Before you can use your custom domain with API Gateway, you need to request a certificate for your domain using AWS Certificate Manager (ACM). This certificate is used to secure communication between clients and your API Gateway endpoints.

Once you click on “Request,” choose “Request a public certificate,” and then proceed by clicking “Next.”

Next, you’ll need to provide a Fully Qualified Domain Name (FQDN), while keeping the remaining settings at their defaults.

Afterward, you’ll find the entry listed in your certificate inventory.

Click on the certificate to retrieve its CNAME name and corresponding value, which you’ll need to add to your DNS configuration.

Step 3: Add DNS Record for Validation

After adding the values, await AWS validation. You’ll notice the certificate’s status transitioning from “Pending Validation” to “Issued” shortly.

Be mindful that your DNS Record manager might encounter issues with the full stop at the end of the name; in my case, removing it led to successful verification of the record.

Step 4: Set Up Custom Domain Name in API Gateway

  1. Click Custom domain name under API Gateway
  2. Create a domain name
  3. Provide the example domain name your registered your cert with and choose the issued cert
  4. Click “Create domain name”

Step 5: Add DNS Record for Custom Domain Name

Once you have set up the custom domain name, you can find the API Gateway Domain name under the configurations section to link with your domain name.

Add the DNS Record

Step 5: Set Up API mapping

Finally, within the configurations, locate the API mappings section where you’ll be required to add an API Gateway API and its corresponding stage.

You’re done.

To verify CNAME propagation, utilize https://dnschecker.org/. Once confirmed, proceed to test the API using your browser, Postman, or curl by accessing it via the domain name.

--

--