Skip to content

Instantly share code, notes, and snippets.

@abelmferreira
Created July 14, 2019 14:01
Show Gist options
  • Save abelmferreira/5c6d5b6ab06b19a237dbae750d1093b3 to your computer and use it in GitHub Desktop.
Save abelmferreira/5c6d5b6ab06b19a237dbae750d1093b3 to your computer and use it in GitHub Desktop.
Export AWS Route53 zone
#!/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
#!/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