Skip to content

Sometimes you just want to get all the records for all the domains you have hosted at Amazon 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.

Get Your Route 53 DNS Records: Step 1

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

Get Your Route 53 DNS Records: Step 2

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.

Take the first step to

reclaim the power of tech

Your goals, our guides.
Let's set great things in motion.

Work With Us

THE LIFT

Subscribe to THE LIFT

THE LIFT is our monthly e-newsletter full of tools, tips, resources, and real-world examples of how you can reclaim the power of tech, and a great way to keep us your radar.

Get THE LIFT