Skip to content

Instantly share code, notes, and snippets.

@hablutzel1
Created December 15, 2023 19:37
Show Gist options
  • Save hablutzel1/4eb7f393aab8196362fa7270396126c2 to your computer and use it in GitHub Desktop.
Save hablutzel1/4eb7f393aab8196362fa7270396126c2 to your computer and use it in GitHub Desktop.
#!/bin/bash
IP_ADDRESS="$1"
HOSTED_ZONES=$(aws route53 list-hosted-zones)
echo "$HOSTED_ZONES" | jq -r '.HostedZones[].Id' | while read ZONE_ID; do
RECORD_SETS=$(aws route53 list-resource-record-sets --hosted-zone-id "$ZONE_ID" --query "ResourceRecordSets[?ResourceRecords[?Value == '$IP_ADDRESS']].Name")
for RECORD_SET in $RECORD_SETS; do
echo $RECORD_SET
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment