Skip to content

Instantly share code, notes, and snippets.

@Wintus
Forked from sasasin/dump_route53_hosted_zones.sh
Last active January 20, 2022 09:35
Show Gist options
  • Save Wintus/878e3c44c3def8d7b58a9a95ba0ea2f3 to your computer and use it in GitHub Desktop.
Save Wintus/878e3c44c3def8d7b58a9a95ba0ea2f3 to your computer and use it in GitHub Desktop.
AWS Route 53 hosted zones 中身を全部出すやつ
#!/bin/bash -e
aws route53 list-hosted-zones-by-name --output text --query 'HostedZones[].Id' \
| xargs -I@ -P$(nproc) \
aws route53 list-resource-record-sets \
--hosted-zone-id @ \
--query 'ResourceRecordSets[].{name:Name,type:Type,records:ResourceRecords[].Value,alias:AliasTarget.DNSName}' \
| jq -r '.[] | . as $_ | .records[] | [ $_.name, $_.type, ., $_.alias ] | @tsv' \
| sort