Skip to content

Lab 10 · Route 53 & CloudFront

Performance · Est. time: 30–35 min · Cost: CloudFront + S3 for a small static site is within/near Free Tier. ⚠️ A Route 53 hosted zone is ~\$0.50/month and registering a domain costs money — the Route 53 part is optional/read unless you already own a domain.

Goal. Put CloudFront in front of an S3 static site to cache content at the edge, and understand Route 53 routing policies and CloudFront vs Global Accelerator (Topic 10).


Part A — S3 static content + CloudFront

  1. S3 → Create bucket lab-cdn-<random>. Upload an index.html with any content.
  2. CloudFront → Create distribution. Origin = your S3 bucket.
  3. Use Origin Access Control (OAC) so the bucket stays private and only CloudFront can read it (CloudFront gives you a bucket policy to paste). Default root object: index.html.
  4. Create, wait for Deployed, then open the distribution domain name (d123.cloudfront.net) — your content is now served from edge locations.
aws s3 mb s3://lab-cdn-$(date +%s)
aws s3 cp index.html s3://<bucket>/
# create-distribution with an S3 origin + OAC (JSON config)

Point: CloudFront caches the content near users, cutting latency and offloading the origin. Edit the object and note caching/TTL behavior (use an invalidation to force a refresh).


Part B — Route 53 routing policies (concept + optional)

If you own a domain in a Route 53 hosted zone, create records to feel the policies. Otherwise, just internalize the map:

Policy Use
Simple One record
Weighted Split by % (canary)
Latency-based Fastest Region
Failover Active-passive (with health checks)
Geolocation By user location (compliance)
Multivalue Up to 8 healthy records
  1. Route 53 → Hosted zones → your zone → Create record.
  2. Choose Alias → target your CloudFront distribution (Alias is free and works at the zone apex, which a CNAME can't).
  3. Experiment with Weighted or Latency routing across two records.

Point: an Alias record points a root domain at AWS resources (ELB/CloudFront/S3); Latency-based ≠ Geolocation (fastest vs by-location).


Part C — CloudFront vs Global Accelerator (know the difference)

  • CloudFrontcaches HTTP/S content at the edge (what you built).
  • Global Acceleratorroutes TCP/UDP traffic over the AWS backbone to the nearest healthy endpoint with static anycast IPs and instant failover; no caching. Use it for gaming/VoIP/ IoT or when you need static IPs.

Teardown

  1. Disable then delete the CloudFront distribution (disabling takes a few minutes).
  2. Empty and delete the S3 bucket.
  3. Delete any Route 53 records you created (and the hosted zone if you made one just for this — it bills monthly).
# disable distribution (update-distribution with Enabled=false), then delete-distribution
aws s3 rb s3://<bucket> --force

✅ What you should understand now

  • CloudFront caches static/dynamic content at edge locations to cut latency and offload the origin; use OAC to keep the S3 origin private.
  • Route 53 policies: Latency (fastest), Geolocation (by location), Weighted (canary), Failover (active-passive), Multivalue (health-checked spread).
  • An Alias record (not CNAME) points the zone apex at ELB/CloudFront/S3, for free.
  • CloudFront caches content; Global Accelerator routes TCP/UDP traffic (static IPs, no cache).
  • A Route 53 hosted zone bills monthly — delete it if you created one just to test.

Related: Learn — Networking Performance