AWS Route 53: How to migrate a hosted zone from one account to another completely

amazon-route53amazon-web-servicesdomain-name-system

I have two AWS accounts old and new.

I have a hosted ZONE on old account under Route 53 service.

I want to migrate it completely from old to new.

How can I do it ? Are there any predefined steps for such case ?

Please note that the hosted zone is being used in a live environment. I can not risk too much trial and error.

Best Answer

You can also use jq ("sed for JSON") to convert the JSON output of list-resource-record-sets to the JSON input to change-resource-record-sets:

jq '.ResourceRecordSets 
  |{"Changes":[.[] 
  |select(.Type!="SOA") 
  |select(.Type!="NS") 
  |{"Action":"CREATE","ResourceRecordSet":.}]}' 

This assumes you have already created the new hosted zone and that it is empty except for the SOA and NS records, which are therefore removed from the JSON file. (The line breaks are for readability; remove them to use the command.)

Related Topic