Last active
December 18, 2024 08:46
-
-
Save michaelact/1c2272c255b0b636227d4569715204ab to your computer and use it in GitHub Desktop.
Export all of your zonefile from Amazon Route 53
This file contains hidden or 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 | |
# Reference: https://stackoverflow.com/questions/20337749/exporting-dns-zonefile-from-amazon-route-53 | |
HOSTED_ZONE_IDS=$(aws route53 list-hosted-zones --query "HostedZones[*].Id" --output text) | |
for zoneId in $HOSTED_ZONE_IDS; do \ | |
echo $zoneId >> records.txt | |
aws route53 list-resource-record-sets --hosted-zone-id $zoneId --output json | jq -jr '.ResourceRecordSets[] | "\(.Name) \t\(.TTL) \t\(.Type) \t\(.ResourceRecords[]?.Value)\n"' >> records.txt | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment