Route 53, CloudFront and Global Accelerator: DNS Routing Policies, CDN Caching and Global Performance
DNS in One Minute
DNS translates names like shop.example.com into IP addresses. A browser asks a resolver, which asks root, TLD (.com) and then the authoritative name servers for your domain. Route 53 can be your authoritative DNS (and also register domains).
Route 53 Basics
| Concept | Meaning |
| Hosted zone | A container of DNS records for a domain. Public (internet) or Private (resolves only inside chosen VPCs) |
| Record types | A (IPv4), AAAA (IPv6), CNAME (name to name, not allowed at the zone apex), MX, TXT, NS, SRV, CAA |
| TTL | How long resolvers cache an answer. Lower TTL before a change for faster switch |
| Alias record | A Route 53-specific record pointing to an AWS resource (ALB, CloudFront, S3 website, API Gateway, Global Accelerator, another record). Works at the zone apex, free queries, follows IP changes, can use health checks |
| Health check | Route 53 checks endpoints (HTTP, HTTPS, TCP), a CloudWatch alarm, or other health checks (calculated) |
Alias vs CNAME: At the root domain (example.com) you cannot use a CNAME. Use an alias A record to an ALB or CloudFront. Prefer alias for AWS targets.
bash
aws route53 create-hosted-zone --name example.com --caller-reference $(date +%s)
cat > change.json <<'JSON'
{"Changes":[{"Action":"UPSERT","ResourceRecordSet":{
"Name":"shop.example.com","Type":"A",
"AliasTarget":{"HostedZoneId":"Z35SXDOTRQ7X7K","DNSName":"web-alb-123.ap-south-1.elb.amazonaws.com","EvaluateTargetHealth":true}}}]}
JSON
aws route53 change-resource-record-sets --hosted-zone-id Z123ABC --change-batch file://change.jso
Routing Policies
| Policy | How it routes | Use for |
| Simple | One record, possibly several values returned randomly. No health checks for multiple values | One resource |
| Weighted | Split by weights (for example 90/10) | Canary releases, A/B tests, gradual migration |
| Latency | To the Region with the lowest latency for the user | Multi-Region apps for speed |
| Failover | Primary and secondary (active-passive) using health checks | Disaster recovery, a static maintenance page |
| Geolocation | By user's country or continent | Language, licensing, legal limits, local content |
| Geoproximity | By distance between user and resources, with a bias to shift traffic (needs Traffic Flow) | Shift load towards or away from a Region |
| Multivalue answer | Up to 8 healthy records returned | Simple client-side load distribution with health checks |
| IP-based | By the user's network (CIDR) location | Route specific ISPs or corporate ranges |
json
{"Changes":[
{"Action":"UPSERT","ResourceRecordSet":{"Name":"api.example.com","Type":"A","SetIdentifier":"primary-mumbai","Failover":"PRIMARY","HealthCheckId":"abcd-1234",
"AliasTarget":{"HostedZoneId":"Z35SXDOTRQ7X7K","DNSName":"alb-mum.ap-south-1.elb.amazonaws.com","EvaluateTargetHealth":true}}},
{"Action":"UPSERT","ResourceRecordSet":{"Name":"api.example.com","Type":"A","SetIdentifier":"secondary-ireland","Failover":"SECONDARY",
"AliasTarget":{"HostedZoneId":"Z32O12XQLNTSW2","DNSName":"alb-ire.eu-west-1.elb.amazonaws.com","EvaluateTargetHealth":true}}}]}
- Private hosted zones resolve internal names (like
db.corp.internal) inside your VPCs
- Route 53 Resolver with inbound/outbound endpoints connects DNS between your VPC and on-premises networks
- DNSSEC signing and domain registration are supported
- Failover and latency records combine (nested records) for complex designs
Amazon CloudFront
CloudFront is a content delivery network (CDN) with hundreds of edge locations that cache content close to users, lowering latency and taking load off your origin. It also provides HTTPS, DDoS protection with Shield Standard, and WAF integration.
| Concept | Meaning |
| Distribution | Your CloudFront configuration with a domain name (d111.cloudfront.net) and optional alternate domain names |
| Origin | Where content comes from: S3 bucket, ALB, EC2, API Gateway, any HTTP server, MediaPackage |
| Cache behavior | Rules by path pattern (/images/*, /api/*) with their own origin, cache policy, allowed methods |
| Cache policy / TTL | What is part of the cache key (headers, cookies, query strings) and how long objects live. Smaller cache key = better hit ratio |
| Invalidation | Remove objects before TTL ends. First 1,000 paths per month free. Prefer versioned file names |
| Origin group | Primary and secondary origin for origin failover |
| Price class | Limit to cheaper edge regions to lower cost |
Secure the Origin and Content
- Origin Access Control (OAC): lets CloudFront read a private S3 bucket using SigV4. The bucket policy allows only the CloudFront service for that distribution. (OAC replaces the older OAI)
- For ALB origins: restrict by a secret custom header or the CloudFront managed prefix list in the security group
- Signed URLs (one file) and signed cookies (many files) give paid or private content access for limited time. Use key groups
- Field-level encryption for sensitive form fields
- AWS WAF and Shield at the edge, geo restriction, HTTPS only (redirect HTTP to HTTPS), a certificate from ACM in us-east-1
json
{
"Version": "2012-10-17",
"Statement": [{
"Sid": "AllowCloudFrontServicePrincipal",
"Effect": "Allow",
"Principal": {"Service": "cloudfront.amazonaws.com"},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::acme-site/*",
"Condition": {"StringEquals": {"AWS:SourceArn": "arn:aws:cloudfront::123456789012:distribution/E1ABCDEF"}}
}]
}
Edge Compute
| Option | Runs | Use for |
| CloudFront Functions | At all edge locations, JavaScript, sub-millisecond, viewer request/response only | URL rewrites, redirects, header changes, simple auth tokens |
| Lambda@Edge | Regional edge caches, more power (network, longer time, all four event types) | Heavier logic, call other services, dynamic personalization |
CloudFront Tips
- Cache static content long (versioned names), API responses short or not at all
- Use compression (gzip/brotli) and HTTP/2 and HTTP/3
- Cache hit ratio and origin latency are the main metrics (CloudWatch)
- Use real-time logs or standard logs to S3 for analysis
- Dynamic content still benefits: CloudFront uses the AWS backbone to the origin and keeps connections open
AWS Global Accelerator
Global Accelerator gives you two static anycast IP addresses. User traffic enters the AWS global network at the nearest edge location and travels over the AWS backbone to your endpoints (ALB, NLB, EC2, Elastic IP) in one or more Regions. It does health checks and fast failover in seconds.
| CloudFront | Global Accelerator |
| What it does | Caches content at the edge | Routes traffic over the AWS network. No caching |
| Best for | Static and cacheable HTTP content, video, websites | Non-HTTP (TCP/UDP): gaming, IoT, VoIP; HTTP needing static IPs; fast regional failover |
| IP addresses | Many, changing | 2 static anycast IPs you can allow-list |
| Failover speed | Origin failover | Seconds, no DNS cache problem |
| Pricing | Per request and data out | Fixed hourly fee plus data transfer premium |
DNS-based failover is slower: Route 53 failover depends on TTL and resolver caching. Global Accelerator switches instantly because the IPs do not change.
Design Examples
| Need | Design |
| Global static website | S3 private bucket + CloudFront (OAC) + ACM + Route 53 alias |
| Web app with users worldwide and one Region | CloudFront with the ALB as origin (dynamic acceleration, WAF) |
| Active-active in two Regions with lowest latency | Route 53 latency records (or Global Accelerator) to ALBs in both Regions, replicated data |
| Active-passive disaster recovery | Route 53 failover with health checks |
| Gaming server UDP traffic worldwide | Global Accelerator with NLB endpoints |
| Private content for paid users | CloudFront signed URLs or cookies |
Practice Tasks
- Create a hosted zone and an alias record pointing to an ALB
- Set up weighted records to send 10 percent of traffic to a test environment
- Configure failover routing with a health check and stop the primary to see the switch
- Serve an S3 site through CloudFront with OAC and verify that direct S3 access is blocked
- Explain when you would pick Global Accelerator over CloudFront
Conclusion
Route 53 provides DNS with alias records and routing policies (weighted, latency, failover, geolocation and more) plus health checks. CloudFront caches content at the edge with OAC for private origins, signed URLs and edge functions. Global Accelerator gives static anycast IPs and fast failover for non-cacheable or non-HTTP traffic.
Quick Summary: DNS + hosted zones; alias vs CNAME; routing policies table + failover JSON; CloudFront origins, behaviors, OAC, signed URLs, edge compute; Global Accelerator vs CloudFront; designs.