AWS CloudFront
"CDN: cache and serve content from edge locations"
What is CloudFront?
CloudFront is AWS’s Content Delivery Network (CDN). It caches your content (static files, APIs) at edge locations worldwide and serves it to users from the nearest edge for lower latency.
Memory hook
"Origin = source (S3, ALB, custom); edge = cache; distribution = CDN config"
Core concepts
- Distribution — CDN configuration (origin, cache behavior, domain)
- Origin — source of content (S3 bucket, Application Load Balancer, custom HTTP server)
- Edge location — cache location; user gets content from nearest edge
- Cache behavior — path pattern + TTL, compress, allowed methods
Typical use cases
- Static assets — images, JS, CSS from S3
- API acceleration — cache GET responses at the edge
- Video / live — media delivery
- HTTPS — SSL/TLS at the edge (custom domain with ACM certificate)
Key features
- Cache TTL — how long objects stay at the edge (e.g. 24h for static)
- Invalidation — purge cached objects (e.g. after deploy)
- Compression — gzip/Brotli at edge
- Custom domain — e.g.
cdn.example.comwith ACM - WAF — optional Web Application Firewall in front
Flow (simplified)
- User requests
https://cdn.example.com/logo.png - DNS routes to nearest CloudFront edge
- Edge has cached copy → return (cache hit)
- Edge has no copy → fetch from origin (S3/ALB) → cache → return (cache miss)
Interview one-liner
"CloudFront is AWS’s CDN: you define a distribution with an origin (e.g. S3 or ALB), cache behavior and TTL. Users get content from the nearest edge; invalidations clear the cache when you update assets."
Cheat sheet
Distribution = CDN config
Origin = S3, ALB, or custom
Edge = cache; TTL = how long to cache
Invalidation = purge cache
Custom domain + ACM = HTTPS at edge