2
votes

I would like to use a custom domain for an AWS API Gateway endpoint, this would allow me to use mydomain.com instead of https://xxxxxxxx.execute-api.eu-west-1.amazonaws.com/v1.

I managed to add the custom domain in API Gateway but now I need to set the DNS of the domain (this domain is NOT managed by Route53).

As far as I understand I should set an A record but I don't have any IP provided by the cloudfront distribution and it cannot be a CNAME because I want to bind a domain (apex) not a subdomain.

How could I set the domain, without transfering DNS management to Route 53 ?

Thank you

2

2 Answers

3
votes

This is not possible. Route 53 has special capabilities that allow you to alias the apex of a domain to another AWS resource, without using a CNAME record -- which is not valid at the apex of a domain.

You don't have to transfer your domain registration to Route 53 -- that's optional -- but you do have to create a hosted zone and configure your existing registrar to use the nameservers Route 53 assigns to your new hosted zone as your authoritative name servers. Transferring the registration itself, or not, does not impact performance -- queries are neither slower nor faster when your domain name host and your registrar are two different providers or not.

1
votes

I struggled quite a bit with the same problem and actually found a solution in this gist. As the gist suggests, you need to create a "Hosted Zone" in Route 53 (you don't need to transfer the domain or anything like that).

Once you create the zone, NS records are created in it. They look something like this:

ns-1208.awsdns-23.org.
ns-2016.awsdns-60.co.uk. 
ns-642.awsdns-16.net. 
ns-243.awsdns-30.com.

Just copy the NS (name server) records and replace the ones for your domain name at your DNS provider's control panel. The NS records can be used to point DNS management from other domain registrar to AWS Route 53

This would take a while to update (around 1-2 days). You can go on and create an alias record in this hosted zone to point your apex domain to your API gateway (or a similar AWS service which doesn't provide a static IP).