Skip to content

Instantly share code, notes, and snippets.

@g3rhard
Forked from tibu/get-zone.sh
Created August 27, 2018 11:24
Show Gist options
  • Save g3rhard/2845825cdb124ac484bea3b57bcb07de to your computer and use it in GitHub Desktop.
Save g3rhard/2845825cdb124ac484bea3b57bcb07de to your computer and use it in GitHub Desktop.
Download zone file in bind format from AWS Route53
#!/bin/bash
# download zone from AWS Route53
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