Search code examples
amazon-web-servicesaws-api-gatewayamazon-route53aws-route-table

How to create route53 record for AWS Gateway API


I have existing hosted zone and A record in AWS route 53. The A record is pointing to cloudfront distribution. lets say the hosted zone name is abcd.ci.example.io. The A record name is same as hosted zone. I can access the web site at abcd.ci.example.io without any issue.

I also have AWS Gateway API with invoke url https://xxxxx.execute-api.us-west-2.amazonaws.com/dev I can access a particular API route from the browser using invoke url https://xxxxx.execute-api.us-west-2.amazonaws.com/dev/v1/healthcheck

I want to assign a custom domain name to invoke url. So I created a new CNAME record in the hosted zone as api.abcd.ci.example.io and set the value to https://xxxxx.execute-api.us-west-2.amazonaws.com/dev

But then when I try to access a route using https://api.abcd.ci.example.io/v1/healthcheck I get error This site can’t be reached

A simple command line ping to api.abcd.ci.example.io also returns error as Ping request could not find host api.abcd.ci.example.io. Please check the name and try again.

Below is list of records in hosted. There are couple of acm validation records as well for both the domains.

enter image description here


Solution

  • Before API Gateway will let you point your custom domain to it, you first have to setup the custom domain in API Gateway, which includes setting up the SSL certificate API Gateway will use for that custom domain.