← Course Index

Route 53 — Custom Domains

~20 min · AWS

Ref
Primary Source
AWS Route 53 Developer Guide

Official documentation for DNS routing, hosted zones, and record management. Read →

Route 53 Overview

Route 53 is AWS's managed DNS service. You create a hosted zone for your domain, then add DNS records. It integrates natively with other AWS services — CloudFront, EC2, ALB — and supports health-check-based routing.

# Create a hosted zone for your domain
aws route53 create-hosted-zone   --name yourapp.com   --caller-reference "$(date +%s)"

# Note the NameServers in the output — update these at your registrar
# (Namecheap, GoDaddy, etc.) to delegate DNS to Route 53

Common Record Configurations

# Point apex domain to CloudFront (use ALIAS, not CNAME)
# In the Route 53 console or via CLI:
{
  "Name": "yourapp.com",
  "Type": "A",
  "AliasTarget": {
    "DNSName": "d1234.cloudfront.net",
    "EvaluateTargetHealth": false,
    "HostedZoneId": "Z2FDTNDATAQYW2"  // CloudFront hosted zone ID
  }
}

# www subdomain → CloudFront
{
  "Name": "www.yourapp.com",
  "Type": "CNAME",
  "TTL": 300,
  "ResourceRecords": [{"Value": "d1234.cloudfront.net"}]
}

# api subdomain → EC2 Elastic IP
{
  "Name": "api.yourapp.com",
  "Type": "A",
  "TTL": 300,
  "ResourceRecords": [{"Value": "54.210.1.100"}]
}
💡 ALIAS records

Route 53's ALIAS record is like a CNAME but works on the apex domain (yourapp.com). Use ALIAS when pointing to CloudFront, S3, or ALBs. It's free and resolves at the DNS layer.

Health Checks & Failover

Route 53 can monitor your endpoints and automatically failover to a backup if the primary goes down:

# Create a health check
aws route53 create-health-check   --caller-reference "$(date +%s)"   --health-check-config     'Type=HTTPS,FullyQualifiedDomainName=yourapp.com,Port=443,ResourcePath=/health'

# Route 53 will poll /health every 30 seconds
# If it fails 3 consecutive checks, it marks the record unhealthy
# and routes traffic to the failover record

Check Your Understanding

1. Why can't you use a CNAME for your apex domain (yourapp.com) pointing to CloudFront?
2. After creating a Route 53 hosted zone, what must you do at your domain registrar?
3. Route 53 ALIAS records pointing to CloudFront are free. What's the equivalent cost for a CNAME record query?