Created
July 14, 2019 14:01
-
-
Save abelmferreira/5c6d5b6ab06b19a237dbae750d1093b3 to your computer and use it in GitHub Desktop.
Export AWS Route53 zone
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 | |
# Export a AWS DNS Route53 Zone to file | |
# Install and configure AWS CLI first | |
# Usage: exportRoute53Zone.sh zonename | |
zonename=$1 | |
hostedzoneid=$(aws route53 list-hosted-zones | jq -r ".HostedZones[] | select(.Name == \"$zonename.\") | .Id" | cut -d'/' -f3) | |
aws route53 list-resource-record-sets --hosted-zone-id $hostedzoneid |
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 | |
# Export a AWS DNS Route53 Zone to file in json format | |
# Install and configure AWS CLI first | |
# Usage: exportRoute53Zone.sh zonename | |
zonename=$1 | |
hostedzoneid=$(aws route53 list-hosted-zones | jq -r ".HostedZones[] | select(.Name == \"$zonename.\") | .Id" | cut -d'/' -f3) | |
aws route53 list-resource-record-sets --hosted-zone-id $hostedzoneid --output json | jq -jr '.ResourceRecordSets[] | "\(.Name) \t\(.TTL) \t\(.Type) \t\(.ResourceRecords[].Value)\n"' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment