Bootstrap FreeKB - Amazon Web Services (AWS) - List DNS Route 53 Hosted Zones using the AWS CLI
Amazon Web Services (AWS) - List DNS Route 53 Hosted Zones using the AWS CLI


This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.

Route 53 is Amazon Web Services DNS. For example, Route 53 can be used to create an A record to associate a hostname such as www.example.com to a public IP address.

In Route 53, a Hosted Zone contains the DNS records for your domain, such as example.com. You can have different Hosted Zones, such as one for example.com and another for sample.com.

The aws route53 list-hosted-zones command can be used to list the Hosted Zones that have been created.

~]$ aws route53 list-hosted-zones
{
    "HostedZones": [
        {
            "Id": "/hostedzone/Z056866DJM1OE9C45GH42",
            "Name": "example.com.",
            "CallerReference": "RISWorkflow-RD:98abdc50-5adf-1234-abdc-471041234a6c",
            "Config": {
                "Comment": "HostedZone created by Route53 Registrar",
                "PrivateZone": false
            },
            "ResourceRecordSetCount": 3
        }
    ]
}

 

And here is an example of how to limit the output using the --query option.

~]$ aws route53 list-hosted-zones --query 'HostedZones[?Name==`example.com`]'
[
    {
        "Id": "/hostedzone/Z05686652SMOE9CSNT942",
        "Name": "example.com",
        "CallerReference": "RISWorkflow-RD:982d7c50-5adf-4481-b0c8-471040c74a6c",
        "Config": {
            "Comment": "HostedZone created by Route53 Registrar",
            "PrivateZone": false
        },
        "ResourceRecordSetCount": 3
    }
]



Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 96ef1a in the box below so that we can be sure you are a human.