Problem
You would like to have a list of your subdomains for a specific domain (hosted zone), that are hosted in Amazon’s Route 53.
Solution
You can install the aws cli docker image from here https://github.com/cgswong/docker-aws if you don’t want to install the aws cli in your computer.
You can afterwards start the container with:
docker run -it cgswong/aws:latest
Then configure it by running the following and adding your credentials and zone:
efe9881d4fd:/tmp# aws configure
AWS Access Key ID [None]: aws_access_key_id
AWS Secret Access Key [None]: aws_secret_access_key
Default region name [None]: eu-central-1
Default output format [None]:
Then run the first command to get a list of the hosted zones and get the id of the hosted zone you want to find the subdomains for:
3efe9881d4fd:/tmp# aws route53 list-hosted-zones
{
"HostedZones": [
{
"ResourceRecordSetCount": 2,
"CallerReference": "RISWorkflow-RD:xxxxx",
"Config": {
"Comment": "HostedZone created by Route53 Registrar",
"PrivateZone": false
},
"Id": "/hostedzone/HOSTEDZONEID",
"Name": "domain.net."
},
Then pick the HOSTEDZONEID and run the following to get a list of subdomains for that domain:
3efe9881d4fd:/tmp# aws route53 list-resource-record-sets --hosted-zone="HOSTEDZONEID" | grep "Name" | uniq
"Name": "alpah.domain.com.",
"Name": "beta.domain.com.",
"Name": "lamda.domain.com.",
......