Route53 zone export to BIND

Amazon Route53 by default does not export BIND format. If you want to do any migration of hosted zones at all, you will have to use the following trick:

aws route53 list-resource-record-sets --hosted-zone-id ZONEXYZ --output json \
    | jq -jr '.ResourceRecordSets[] | "\(.Name) \t\(.TTL) \t\(.Type) \t\(.ResourceRecords[]?.Value)\n"'

This converts this:

{
    "ResourceRecordSets": [
        {
            "Name": "some_other_domain.com.",
            "Type": "NS",
            "TTL": 3600,
            "ResourceRecords": [
                {
                    "Value": "ns-109.awsdns-13.com."
                },
...

To this:

adserver.some_other_domain.com. 	1 	CNAME 	org-296-0f667-dmyt03fffff5xx.domain.com
jita.some_other_domain.com. 	60 	CNAME 	generic-jita-dmyt03fffff5xx.domain.com
vcache.some_other_domain.com. 	60 	CNAME 	vcache-dmyt03fffff5xx.domain.com
...

References

  • Nothing here.