This article contains some preamble (which I suggest you read). But if you got here from Google search looking for an explanation (and solution) for why the Amazon Route 53 hosted zone you deleted and recreated isn’t working, skip straight to this section.
Amazon Route 53: Some Background From My Personal Experience
I love the Amazon Route 53 DNS service for many reasons:
- It lets me keep a domain in the same central location with other domain-related cloud artifacts. No need bringing too many third-party vendors into the picture.
- For domains registered with Amazon Route 53, you get free WhoIs privacy. This is a service that other domain registrars usually charge extra for.
- Route 53 prices are generally cheaper comparatively.
- The Amazon Route 53 service is extremely powerful, flexible, and fast. I’m pretty sure using this service has boosted my productivity significantly when doing domain and DNS work.
- It allows for sophisticated traffic routing policies.
- Integrates tightly with the slew of other AWS cloud services.
The only thing I don’t like about Amazon Route 53 is that you’re charged for monthly DNS queries. You’re also charged monthly for each hosted zone (the equivalent of a traditional DNS zone file).
So, if you have a large number of websites that get a good amount of traffic, the monthly cost of your DNS queries and hosted zones may escalate quickly and easily nullify the pricing advantage of Amazon Route 53 (point #3 noted above).
If you don’t carefully monitor your costs when using Amazon Route 53, you may even end up paying a lot more than if you just went with a traditional domain registrar.
A Cost Saving Idea
One way to save cost when using Route 53 is to leave your domains registered with AWS but move your nameservers and DNS records management to a free DNS provider like Cloudflare. I have previously written a whole article about how to do this. See here: How To Get Free DNS From Cloudflare Without CDN Or Other Extra Features.
By leaving your domains registered with Amazon Route 53 and moving your DNS to a free service like Cloudflare, you take advantage of the cheap domain registration costs of AWS while also avoiding the potentially steep monthly costs associated with hosted zones and DNS queries. Win-win if you ask me!
Okay, now let’s talk about deleting and recreating Amazon Route 53 hosted zones.
If you plan to follow my suggestion above on saving costs by taking advantage of a free DNS service, then you will need to delete your hosted zones after moving them over to the free service.
Depending on your situation, the DNS for some domains might be better left with Route 53 while it might make sense to move the others to free DNS.
Your decision on which domains to move or keep will depend on lots of factors unique to your business. These may include, other AWS services needed on the domain(s) in question, amount of monthly DNS queries for the domain(s), whether the cost savings will be significant enough to be worth the effort, etc. etc.
To say the least, you may have to play with hosted zone deletion and recreation from time to time. And you may quickly notice that recreating a hosted zone requires an extra step to make it work.
The Problem
When you delete a hosted zone in Route 53 and later put it back by recreating it, you’re not exactly putting it back. You would have just created a new hosted zone that is similar (but not identical) to the original one.
When you select a domain in Route 53 “Hosted Zones”, you will notice that there are four nameservers assigned to the hosted zone by Route 53. These values will be the default values of the NS record.
Generally, you should never edit these.
Every time you create a new hosted zone, even if you’re recreating a hosted zone you just deleted (same domain), the four nameservers will always be different. This means that your hosted zone now lives on four new authoritative nameservers in Route 53.
Note: This is an important security measure. By making sure that a deleted and recreated hosted zone always gets a different set of NS records, AWS protects you against the possibility of someone else allocating the same zone using the same nameservers, and thus giving themselves the ability to create malicious records.
But the Internet still expects the four old nameservers (in the deleted hosted zone) to hold your DNS records.
Since you probably weren’t expecting a totally different set of nameservers, you did not take any extra steps. And you may be stumped for a while trying to figure out why your app or website has stopped working.
The Solution: Proper Way Recreate Amazon Route 53 Hosted Zones
The solution is simple: You need to take an extra step to update your authoritative nameservers.
To do this, you need to go to a different part of Route 53. Leave the “Hosted Zones” section and click on “Registered Domains”.
Select your domain and press “Add or edit name servers”. Enter the correct values of the nameservers (the four new ones created for your hosted zone as mentioned above).
After DNS propagation completes, your domain should start resolving correctly again.
Leave a Reply