skip to Main Content
How To Get All The Domain Records For Your Account From Route53
Director of Engineering
June 04 2019

Sometimes you just want to get all the records for all the domains you have hosted at Route 53. You might want to look through them for some setting or anomaly. But clicking around the AWS console is tedious.

The AWS API can rescue you from the tedium. With two simple commands, you can see all your DNS records.

First, get all the hosted zones. You typically have one zone per domain name. So is a zone. (This assumes you have jq installed, which is a must if you are doing any command line processing of json. Trust me, you’ll thank me.)

aws route53 list-hosted-zones|jq '.[] | .[] | .Id' | sed 's!/hostedzone/!!' | sed 's/"//g'> zones

Then, for each of these zone ids, we want to pull all the record sets and store them off to a file for further examination later.

for z in `cat zones`; do 
  echo $z; 
  aws route53 list-resource-record-sets --hosted-zone-id $z >>  records; 

When I have to do something repeatedly with AWS, I always ask myself: “is this a readonly operation?” If so, I often reach for the unix command line tools, jq and the aws CLI, as above.

Back To Top