Last active
March 29, 2021 12:08
Star
You must be signed in to star a gist
a short shell script to copy the contents from one Route53 hosted zone to the other
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
aws route53 list-resource-record-sets \ | |
--hosted-zone ${SOURCE_HOSTED_ZONE_ID} \ | |
--query '{Changes: ResourceRecordSets[?Type != `NS` && Type != `SOA`].{"Action": `UPSERT`, "ResourceRecordSet": @ }}' > changeset.json | |
aws route53 change-resource-record-sets \ | |
--hosted-zone ${TARGET_HOSTED_ZONE_ID} \ | |
--change-batch "$(<changeset.json)" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! It helped a lot.
But it only worked after I changed
INSERT
toCREATE
on the 4th line.An error occurred (InvalidInput) when calling the ChangeResourceRecordSets operation (reached max retries: 2): Invalid XML ; cvc-enumeration-valid: Value 'INSERT' is not facet-valid with respect to enumeration '[CREATE, DELETE, UPSERT]'. It must be a value from the enumeration.