Route 53 DNS and CloudFront CDN
Users reach your application by name and expect it to be fast everywhere. Route 53 answers DNS queries; CloudFront serves content from edge locations close to users.
flowchart LR
U[User in Pune] -->|"1 DNS: shop.example.com?"| R53[Route 53]
R53 -->|"2 alias → d123.cloudfront.net"| U
U -->|3 HTTPS| E[CloudFront edge – Mumbai]
E -->|cache miss| O1["Origin: S3 (static)"]
E -->|"/api/*"| O2["Origin: ALB (dynamic)"]
Route 53
| Concept | Meaning |
|---|---|
| Hosted zone | Container for the DNS records of a domain (public or private to a VPC) |
| A / AAAA | Name → IPv4 / IPv6 |
| CNAME | Name → another name (not allowed at the zone apex) |
| Alias | Route 53 extension: apex-capable pointer to AWS resources (ALB, CloudFront, S3 website) – free queries |
| MX, TXT, NS, SOA | Mail, verification, delegation |
| TTL | How long resolvers cache the answer |
Routing policies
| Policy | Use |
|---|---|
| Simple | One resource |
| Weighted | Split traffic, e.g. 90/10 canary |
| Latency-based | Send users to the lowest-latency Region |
| Failover | Active–passive with health checks |
| Geolocation / geoproximity | By user location |
| Multivalue answer | Several healthy IPs |
CloudFront
| Concept | Meaning |
|---|---|
| Distribution | Your CDN configuration with a domain such as d123.cloudfront.net |
| Origin | Where content comes from – S3, ALB, any HTTP server |
| Behaviour | Path pattern → origin + cache policy (e.g. /api/* no caching) |
| TTL / cache policy | How long edges keep objects; based on headers, cookies, query strings |
| Invalidation | Remove objects from all edges after a deploy (/*) |
| ACM certificate | Free TLS certificate (must be in us-east-1 for CloudFront) |
| Origin Access Control (OAC) | Only CloudFront may read the private S3 bucket |
| AWS WAF, Shield | Web firewall and DDoS protection at the edge |
The modern static-site pattern is private S3 bucket + CloudFront with OAC + Route 53 alias + ACM certificate – fast, HTTPS, and the bucket is never public.
Practise it
Virtual lab · Amazon Web Services · 40 min
Serve a private S3 website worldwide with CloudFront, a custom domain and Route 53
Put CloudFront in front of a private S3 bucket with Origin Access Control, attach a custom domain with an ACM certificate and a Route 53 alias record, watch edge-cache hits and misses, and publish a new version with an invalidation.
Quick revision
- Hosted zones hold records; alias records point the apex to AWS resources.
- Routing policies: simple, weighted, latency, failover, geo, multivalue.
- CloudFront caches at the edge; behaviours route paths to origins.
- Use OAC to keep S3 origins private; invalidate after deploys.
- ACM certificates for CloudFront live in us-east-1.
Practise this topic
Hands-on virtual lab
Apply what you just read in a realistic, guided simulation. Free with a verified account.
Create a free account to track your progress and unlock virtual labs.