AWS CLI

Some cli-fu to get required results from AWS using awscli. To execute these commands please make sure that awscli is configured on your system.

1
2
3
4
for zone in `aws route53 list-hosted-zones | jq -r '.HostedZones[].Id'`; do \
    aws route53 list-resource-record-sets --hosted-zone-id $zone |\
    jq -r '.ResourceRecordSets[]? | "\(.Name),\(.Type),\(.ResourceRecords[]?.Value)"'; \
done
1
2
3
4
5
6
7
8
9
for zone in `aws route53 list-hosted-zones | jq -r '.HostedZones[].Id'`; do 
  aws route53 list-resource-record-sets --hosted-zone-id $zone --query "ResourceRecordSets[?Type == 'CNAME']" |\
  jq -r '.[].Name' |\
    while read record; do \
      if [[ $(host $record | grep 'not found') ]]; then \
        echo $record;
      fi;
    done;
done