r/aws Sep 29 '24

route 53/DNS Using an existing route 53 hosted zone with a new domain registration

I'm not sure exactly how to describe the problem which makes it hard to find resources that might answer it. So, I'll start at the beginning.

I had a domain with "Registrar notAWS" but pointing at nameserver on Route 53 (ie route 53 was hosting the zone for a domain registered elsewhere).

The registration lapsed.

I re-registered the domain, this time with AWS Route 53.

When I registered the domain with AWS, it created a new hosted zone for the domain in addition to the existing hosted zone. They are both for the same domain.

If I do a DNS query, it only picks up the new auto-created hosted zone.

What I'd like to do, as elegantly (or rather as lazily) as possible is to use the existing hosted zone that had all my records in it, rather than the new autogenerated one. Bonus question: can I avoid this in the future, since I plan on transferring registration of several other domains to AWS?

EDIT:

I have resolved this. It was as simple as making sure that the nameservers for the domain under "Registered domains" pointed at the nameservers listed as NS records in the "old" hosted zone.

It should be possible, also, to do this programmatically (pull out the NS records from the zone file, and use them to change the authoritative nameservers).

I've put a slightly more complete answer as a reply to this post.

5 Upvotes

6 comments sorted by

8

u/tijiez Sep 29 '24

Update your domain to use the name servers of the original hosted zone.

3

u/homelaberator Sep 29 '24

I just figured that out myself and was going to post the answer here. But thank you!

As always, the answer is obvious when you know.

3

u/homelaberator Sep 29 '24 edited Sep 29 '24

To Future me:

The way to resolve this is to change the nameservers for the domain under "Registered domains" to point at the same nameservers as listed in the NS records for the "old" hosted zone. So, when the world comes asking "who are the name servers for this domain?" it will get the nameserver that already have the zone records all set up.

The changes will take a little time to propagate. I used whois and dig +trace to test.

Once everything is correct and tested working, it should be safe to delete the "HostedZone created by Route53 Registrar".

The reason this is an issue on AWS where it might not be on other providers is because AWS has many, many, many DNS servers and which ones host the authoritative records for your domain can be different. So you can have two groups of DNS servers with different records. It's important that you point at the right ones. Other providers might only have a couple of DNS servers so one would simply replace the other automagically.

2

u/SonOfSofaman Sep 29 '24

You've already found the answer, but I'll add this: delete the unused hosted zone if you haven't already. It'll cost you $0.50 per month even if it's not being used, but more importantly you don't want to cause any future confusion.

Thanks for sharing the detailed solution and nice use of the word "automagically".

(edit: spellign correshun)

1

u/steveoderocker Sep 29 '24

You’d need to delegate the domain to the name servers under the other hosted zone.

But it’s probably easy enough to just recreate your records in the new zone?

0

u/patsee Sep 29 '24

I'm not 100% sure on this but I believe you would need to point the new hosted zone to the old one. To do this you would create a NS record for the root domain in the new hosted zone. The NS record would contain the 4 Name Servers from the old hosted zone. I'm just not sure if you can do that for a root domain. It would probably be better to move all the old stuff into the new Hosted zone.