AWS Route 53 DNS - CLI Basics

- aws networking dns

This post is part of my note taking while studying for the AWS Certified Advanced Networking - Specialty certification.

This is the first of a few posts about the AWS DNS service, Route 53. Route 53 is an AWS hosted and managed DNS service. It’s fault tolerant, resilient and removes the operation burden of running your own DNS. Here are some basic AWS CLI examples to get started with the service.

Show hosted zones

$ aws route53 list-hosted-zones

{
    "HostedZones": [
        {
            "ResourceRecordSetCount": 5,
            "CallerReference": "4ED3142E-98AF-A128-8195-A910468F10E8",
            "Config": {
                "Comment": "cloudy Lab DNS",
                "PrivateZone": true
            },
            "Id": "/hostedzone/ZABADF32F32DY",
            "Name": "lab.cloudynetworks.net."
        }
    ]
}

List information about one zone

$ aws route53 get-hosted-zone 0--id ZABADF32F32DY

{
    "VPCs": [
        {
            "VPCId": "vpc-5c1abc12",
            "VPCRegion": "us-east-1"
        }
    ],
    "HostedZone": {
        "ResourceRecordSetCount": 5,
        "CallerReference": "4ED3142E-98AF-A128-8195-A910468F10E8",
        "Config": {
            "Comment": "Lab DNS",
            "PrivateZone": true
        },
        "Id": "/hostedzone/ZABADF32F32DY",
        "Name": "lab.cloudynetworks.net."
    }
}

List all records in a zone

$ aws route53 list-resource-record-sets --hosted-zone-id ZABADF32F32DY
{
    "ResourceRecordSets": [
        {
            "ResourceRecords": [
                {
                    "Value": "ns-1536.awsdns-00.co.uk."
                },
                {
                    "Value": "ns-0.awsdns-00.com."
                },
                {
                    "Value": "ns-1024.awsdns-00.org."
                },
                {
                    "Value": "ns-512.awsdns-00.net."
                }
            ],
            "Type": "NS",
            "Name": "lab.cloudynetworks.net.",
            "TTL": 172800
        },
        {
            "ResourceRecords": [
                {
                    "Value": "ns-1536.awsdns-00.co.uk. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400"
                }
            ],
            "Type": "SOA",
            "Name": "lab.cloudynetworks.net.",
            "TTL": 900
        },
        {
            "ResourceRecords": [
                {
                    "Value": "127.0.0.1"
                },
                {
                    "Value": "8.8.8.8"
                },
                {
                    "Value": "8.8.4.4"
                }
            ],
            "Type": "A",
            "Name": "cloudy-test.lab.cloudynetworks.net.",
            "TTL": 300
        },
        {
            "ResourceRecords": [
                {
                    "Value": "10.129.33.126"
                }
            ],
            "Type": "A",
            "Name": "cloudylab-dc1.lab.cloudynetworks.net.",
            "TTL": 300
        },
        {
            "ResourceRecords": [
                {
                    "Value": "10.129.33.133"
                }
            ],
            "Type": "A",
            "Name": "cloudylab-dc2.lab.cloudynetworks.net.",
            "TTL": 300
        }
    ]
}

Retrieve a single record

$ aws route53 list-resource-record-sets --hosted-zone-id ZABADF32F32DY --start-record-name cloudy-test.lab.cloudynetworks.net --start-record-type A --max-items 1
{
    "ResourceRecordSets": [
        {
            "ResourceRecords": [
                {
                    "Value": "127.0.0.1"
                },
                {
                    "Value": "8.8.8.8"
                },
                {
                    "Value": "8.8.4.4"
                }
            ],
            "Type": "A",
            "Name": "cloudy-test.lab.cloudynetworks.net.",
            "TTL": 300
        }
    ],
    "MaxItems": "1",
    "NextRecordType": "A",
    "IsTruncated": true,
    "NextRecordName": "cloudylab-dc1.lab.cloudynetworks.net."
}