Sharing a domain name across multiple AWS accounts

The other day I decided to separate my environments and I came across a problem. How do I get access to my domain from a different account, moreso, will I be able to get an SSL Certificate. Worried that it was going to be tricky, turns out it was super easy. Barely an inconvenience.

By utilising subdomains, we can redirect traffic from the “apex” hosted zone to others.

  1. Create a new hosted zone e.g., dev.exanubes.com - inside, you will have SOA and NS records
  2. Copy the nameservers from the NS Record
  3. Go to the main hosted zone - can be in another account or even in the same one - and create an NS Record for the same domain – e.g., dev.exanubes.com – with the copied nameservers
  4. Profit

Now, thanks to this, you can easily separate environments and use your domain name across accounts. Should you have a domain name bought through some other service, the principal stays the same. Create a hosted zone, get the nameservers and create NS record to reroute traffic to the new nameservers.