3
votes

I have two public hosted zones in Amazon Route 53 for the same domain name (which has Route 53 as registrar), for the reason that Route 53 automatically created one when I registered the domain name and that the second one was created by Terraform.

As far as I can tell, DNS record sets in the second zone aren't applied, i.e. they're not returned for queries to the domain. Do I have to delete the first zone in order for record sets in the second zone to be active?

3

3 Answers

2
votes

As far as I can tell, which hosted zone is active, meaning that its record sets are returned for queries to the domain, depends on the name servers registered with the domain. So, in order to make my second zone active I have to update the domain's name servers, in Route 53, to correspond to those of the desired hosted zone.

1
votes

Following is an extract from the AWS Route 53 FAQ

Q. Can I create multiple hosted zones for the same domain name? 

Yes. Creating multiple hosted zones allows you to verify your DNS setting in a “test” environment, and then replicate those settings on a “production” hosted zone. For example, hosted zone Z1234 might be your test version of example.com, hosted on name servers ns-1, ns-2, ns-3, and ns-4. Similarly, hosted zone Z5678 might be your production version of example.com, hosted on ns-5, ns-6, ns-7, and ns-8. Since each hosted zone has a virtual set of name servers associated with that zone, Route 53 will answer DNS queries for example.com differently depending on which name server you send the DNS query to.

Click here for more details

0
votes

How is Domain-Name, Namespaces, and Hosted-Zone connected?

Imagine you bought a new name from GoDaddy - example.com. Then you setup your website in your EC2 machine which has IP 100.0.0.10. To point example.com to your webserver, you will need to first choose a DNS resolver. AWS provides one - Route53. A DNS resolver translates names like example.com to IP address like 100.0.0.10.

AWS Route53 has a concept of Hosted Zones. You will need to create a hosted zone for example.com. Route53 will then give you nameservers (bunch of different URLs, AWS gives you 4). You will take these nameservers and go back to GoDaddy and there is a section to put those nameservers. This tells GoDaddy where to send the request to.

Why did we do above ^^^ ? When you purchased the name from GoDaddy, GoDaddy became your registrator i.e. it registered your name with the DNS authorities. So whenever someone requests example.com to the DNS authorities, they will forward the request to GoDaddy. So GoDaddy needs to know where to send the request to. These nameservers tells GoDaddy that exact information.

After the request reaches AWS Route53, it knows that this domain name example.com needs to go to 100.0.0.10.

What if I create 2 Hosted Zones with the same domain name example.com?

A hosted-zone is nothing but Route53's way to define a set of route rules for a domain. If you have 2 hosted-zone with the same domain name, you will have 2 sets of namespaces. For AWS, each set has 4 namespace, so total of 8 namespaces).

So now it depends which namespaces you give to GoDaddy. You can give it set A, in which case your second hosted-zone will not receive any traffic. You can give it set B, in which case your first hosted-zone will not receive any traffic. Or, you can give it a mixture of both set A and set B, in which case GoDaddy will send some requests to set A and some to set B, not both though.