Route 53 DNS

Route 53 is a managed DNS service that turns domain names into the addresses of your AWS resources.

Amazon Route 53 is a highly available DNS service. It translates human names like www.example.com into IP addresses and can route users based on health, latency or geography.

Core concepts

  • Hosted zone — a container for the DNS records of one domain.
  • Record typesA (IPv4), AAAA (IPv6), CNAME (alias to another name), MX (mail), TXT (verification).
  • Alias record — an AWS-specific record that points directly at an ELB, CloudFront distribution or S3 website, free of charge.

Routing policies

  • Simple — one record, one target.
  • Weighted — split traffic by percentage (great for canary releases).
  • Latency — send users to the closest Region.
  • Failover — switch to a backup when a health check fails.

Example

Example · json
{
  "Comment": "Point www at the ALB via an alias record",
  "Changes": [
    {
      "Action": "UPSERT",
      "ResourceRecordSet": {
        "Name": "www.example.com",
        "Type": "A",
        "AliasTarget": {
          "HostedZoneId": "Z35SXDOTRQ7X7K",
          "DNSName": "web-alb-1234567890.us-east-1.elb.amazonaws.com",
          "EvaluateTargetHealth": true
        }
      }
    }
  ]
}

When to use it

  • A company points its apex domain (example.com) to an ALB using a Route 53 alias record, avoiding the limitations of CNAME records at the root.
  • Route 53 latency routing directs users to the nearest AWS region automatically, sending US users to us-east-1 and European users to eu-west-1.
  • A developer uses Route 53 health checks to automatically failover traffic from a primary endpoint to a standby endpoint when the primary goes down.

More examples

Create a Hosted Zone

Creates a public hosted zone for a domain and returns the four AWS name servers you set at your domain registrar.

Example · bash
aws route53 create-hosted-zone \
  --name example.com \
  --caller-reference $(date +%s) \
  --query 'HostedZone.{Id:Id,NS:DelegationSet.NameServers}' \
  --output json

Create an A Record Alias for ALB

Creates an alias A record pointing www.example.com to an ALB, enabling health-aware DNS routing without a CNAME.

Example · bash
aws route53 change-resource-record-sets \
  --hosted-zone-id Z1234567890 \
  --change-batch '{
    "Changes": [{
      "Action": "CREATE",
      "ResourceRecordSet": {
        "Name": "www.example.com",
        "Type": "A",
        "AliasTarget": {
          "HostedZoneId": "Z35SXDOTRQ7X7K",
          "DNSName": "web-alb-123.us-east-1.elb.amazonaws.com",
          "EvaluateTargetHealth": true
        }
      }
    }]
  }'

Query DNS Record via CLI

Tests DNS resolution within Route 53 for a record set, confirming the correct IP or alias is returned before propagation.

Example · bash
aws route53 test-dns-answer \
  --hosted-zone-id Z1234567890 \
  --record-name www.example.com \
  --record-type A \
  --query '{Name:RecordName,Value:RecordData,Protocol:Protocol}' \
  --output table

Discussion

  • Be the first to comment on this lesson.