Skip to content

Instantly share code, notes, and snippets.

@porjo
Last active February 15, 2024 14:19
Show Gist options
  • Star 33 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save porjo/7447463ce0d14f212e58f9eabad77090 to your computer and use it in GitHub Desktop.
Save porjo/7447463ce0d14f212e58f9eabad77090 to your computer and use it in GitHub Desktop.
Export route53 records to CSV

Retrieve hosted zones with aws route53 list-hosted-zones then enter the zone Id below:

aws route53 list-resource-record-sets --hosted-zone-id "/hostedzone/xxxxxxxxxxx" | \
   jq -r '.ResourceRecordSets[] | [.Name, .Type, (.ResourceRecords[]? | .Value), .AliasTarget.DNSName?]  | @tsv'
@rikwouters
Copy link

rikwouters commented Feb 15, 2024

Thank you!

Note: I ran a few of these aws/jq commands in a Microsoft Windows shell and got errors like

'[.Name' is not recognized as an internal or external command, operable program or batch file.

Using double quotes makes it work.

list-resource-record-sets --hosted-zone-id "/hostedzone/ZXXXXXXXXXXXXX" | jq -r ".ResourceRecordSets[] | [.Name, .Type, (.ResourceRecords[]? | .Value), .AliasTarget.DNSName?] | @tsv" > abc.tsv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment