Advertisement
s4ros

r53-dns-zone

Jan 30th, 2019
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.49 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [[ -z $1 ]]; then
  4.   echo "Usage: $0 <hosted_zone_domain>"
  5.   exit 1
  6. fi
  7.  
  8. if [[ -z $AWS_PROFILE ]]; then
  9.   echo "Please, export AWS_PROFILE"
  10.   exit 1
  11. fi
  12.  
  13. zonename=$1
  14. hostedzoneid=$(aws route53 list-hosted-zones | jq -r ".HostedZones[] | select(.Name == \"$zonename.\") | .Id" | cut -d'/' -f3)
  15. aws route53 list-resource-record-sets --hosted-zone-id $hostedzoneid --output json | jq -jr '.ResourceRecordSets[] | "\(.Name) \t\(.TTL) \t\(.Type) \t\(.ResourceRecords[].Value)\n"'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement