13. CloudFront
Scenario. Users on four continents download 2 TB/day of images from a private S3 bucket, and the bucket must stay non-public.
How it actually works. CloudFront caches at edge locations. With OAC, CloudFront signs requests to S3 so the bucket stays private. TTLs control freshness; invalidations force refresh but cost money. Signed URLs authorize one object; signed cookies authorize many. Origin groups provide origin failover, CloudFront Functions and Lambda@Edge customize requests at the edge, and WAF/Shield attach at the distribution.
Why the alternative loses. Global Accelerator accelerates TCP/UDP but does not cache — every request still hits the origin. S3 Transfer Acceleration helps uploads, not global read latency. Public buckets are the insecure shortcut.
The trap. Using CloudFront for write-heavy or non-cacheable APIs, then wondering why latency didn't improve; or leaving the bucket public and calling it "CloudFront security." Also: invalidating on every deploy instead of versioning filenames.
Concrete example. images.example.com → CloudFront → OAC → private bucket in us-east-1. A user in Singapore gets a 20 ms edge hit instead of a 220 ms origin fetch.
Exam signals: "global users", "static content", "cache", "reduce latency for reads", "keep bucket private", "DDoS".
Recall: signed URL vs signed cookie — when do you need each?