Skip to content

Instantly share code, notes, and snippets.

@lordjabez
Created May 21, 2025 17:26
Show Gist options
  • Save lordjabez/28401558ec8c184849c6c7f853fa1e31 to your computer and use it in GitHub Desktop.
Save lordjabez/28401558ec8c184849c6c7f853fa1e31 to your computer and use it in GitHub Desktop.
Create a zonefile from Route53
#!/bin/bash
hosted_zone_name="$1"
hosted_zone_id=$(aws route53 list-hosted-zones --output text --query "HostedZones[?Name==\`$hosted_zone_name.\`].Id")
aws route53 list-resource-record-sets --hosted-zone-id "$hosted_zone_id" --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