Route 53 and CloudFront at the Edge
Serve your apps on custom domains with Route 53, put a CloudFront CDN in front for speed and HTTPS, and use ACM certificates.
Intermediate · about 4 hours · difficulty 2/5
Learn first: DNS and How Domains Reach Your Servers, VPC, Subnets, Route Tables and Internet Gateways
The edge is where users first touch your system. Route 53 answers the DNS query, and CloudFront serves content from a location near the user.
Route 53
- Hosted zones hold your records. Public zones answer the internet; private zones answer inside your VPCs.
- Alias records point at AWS resources (ALB, CloudFront, S3 website) and work at the apex.
- Routing policies: weighted for gradual rollouts, latency-based for multi-region, failover with health checks for disaster recovery.
CloudFront
- A CDN with edge locations in many Indian cities, caching static files and even API responses close to users.
- Origins can be S3 buckets, ALBs or any HTTP server.
- Origin Access Control (OAC) lets CloudFront read a private S3 bucket so the bucket never needs to be public.
- Cache behaviours and cache policies control what is cached and for how long. Invalidations clear the cache after a deploy.
Certificates with ACM
AWS Certificate Manager issues free public TLS certificates that renew automatically. For CloudFront the certificate must be created in us-east-1; for an ALB it must be in the ALB's region.
Azure Front Door and Google Cloud CDN with Cloud Load Balancing are the equivalents.
Pitfalls
- Making the S3 bucket public instead of using OAC.
- Forgetting to invalidate or version file names, so users see old JavaScript after a release.
You are ready to move on when you can host a static site on a private S3 bucket behind CloudFront with HTTPS on your own domain.
Key concepts
- Hosted zones
- Alias records
- Routing policies and health checks
- CloudFront distributions and origins
- Origin Access Control
- Cache policies and invalidation
- ACM certificates
- Lambda@Edge and CloudFront Functions
Mini project
Host your portfolio on a private S3 bucket behind CloudFront with OAC and an ACM certificate. A Route 53 hosted zone costs a small monthly fee, so you can use a free subdomain or the CloudFront domain instead. Stay within free tier and delete the distribution if you are not keeping it.
Check yourself
Why must an ACM certificate for CloudFront live in us-east-1 even if your bucket is in Mumbai?