Felix Hanley

AWS route53

2026-08-14 aws dns

Dump a zone from Route 53

This does not extract ‘alias’ records, need to grab them separately.

#!/bin/sh

zonename=$1
hostedzoneid=$(aws route53 list-hosted-zones --output json | 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"'