Skip to content

Instantly share code, notes, and snippets.

@afeld
Created March 9, 2020 21:09
Show Gist options
  • Save afeld/f50df6f500d906d61d8f12863c3d58b9 to your computer and use it in GitHub Desktop.
Save afeld/f50df6f500d906d61d8f12863c3d58b9 to your computer and use it in GitHub Desktop.

Revisions

  1. afeld created this gist Mar 9, 2020.
    14 changes: 14 additions & 0 deletions domains.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    #!/bin/bash

    set -eo pipefail

    aws route53 list-hosted-zones --query 'HostedZones[].Id' | \
    jq -r '.[]' | sed 's/\/hostedzone\///' \
    | \
    xargs -I zone_id \
    aws route53 list-resource-record-sets \
    --hosted-zone-id zone_id \
    --query "ResourceRecordSets[?Type == 'A' || Type == 'AAAA' || Type == 'CNAME'].Name" | \
    jq -r '.[]' \
    | \
    sed -E 's/^www\.|\.$//' | egrep -v '_domainkey|\w{30,}' | sort -u