For one reason or another, I’ve had to transfer domains between AWS accounts a number of times, and it’s always a little bit tricky. Part of the problem is that AWS’s documentation for moving a hosted zone to another AWS account is just awful. Any tutorial that is giving you specific lines to delete is creating more work than it’s solving. The official AWS CLI docs (see the --change-batch option) that it’s trying to simplify are just as bad.

One of these days I’ll write a tool to complete this whole process from end to end. For now I’ve written a little helper script for the worst part of it that I’ll use below.

Let’s go!

Moving Hosted Zones #

If you’ve set up any sort of records in AWS Route 53 for the domain you want to move, you’ll probably want to get those moved over. I’ve created a little Ruby script to help do this for you. Keep in mind that at this stage the script is very simple — I’ve only tested it with A and CNAME records, and it doesn’t handle batches so it won’t work for Hosted Zones with > 300 records. It should be pretty easy to modify though! The code can be found here .

Assuming you have Ruby installed, it should be as easy as

That should do it for migrating your Hosted Zone!

Sending Domain #

Heads Up! As we get into sending and receiving domains, I should note that an important thing here is to keep track of what AWS credentials or profile you are using. You’ll want to make sure you are sending with the old profile and receiving with the new one. I’ve found this to be really helpful to do with a teammate, where one assumes each AWS profile and you send to each other. If you can’t do that, a tool like awsctx can be really helpful.

To send a domain, you just use a simple CLI command (docs here ) where you provide the domain you wish to send and the account ID of the account you are sending the domain to.

You’ll see this command spits out an OperationId and a Password. Keep track of those! You can use the OperationId to cancel a domain transfer or to see if it’s been accepted or rejected .

Receiving Domain #

On the receiving side, make sure you’re in the right AWS profile. Then, using the password from above, run this cli command .

And you should be all set! If you run into any problems with this command, try fiddling with the password param (with quotes, without). Sometimes you get a backslash in the password and it acts funny.

Change Domain Name Servers #

After all this, the last step is to change the domain’s name servers to point to your new Hosted Zone! In the Route 53 console, click on the registered domain and change the Name Servers to match those of the Hosted Zone you created.

That’s it! Let me know if I’m missing anything 😄