Skip to content
Technology
How To Get All The Domain Records For Your Account From Route53
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 culturefoundry.com 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; 
done

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.

Culture Foundry is a digital experience agency that helps our clients elevate their impact with beautiful technology. We provide the expertise and insight at every layer that makes a great digital experience for websites and applications possible. If you're committed to elevating your digital experience, contact us and we'd be happy to schedule a chat to see if we're a fit.

(Psst! We also happen to be a great place to work.)

Back To Top
Search