1.CloudFront Core Vocabulary
A distribution tells CloudFront where to get content (the origin — S3, an ALB, a custom HTTP server) and how to cache and route it. Cache behaviors match request paths to specific settings; a cache policy controls what varies the cache key (headers, cookies, query strings); an origin request policy controls what gets forwarded to the origin. Edge locations are the worldwide points of presence that actually cache and serve content close to viewers.
Key features
- Distribution: the CloudFront configuration tying together origins, cache behaviors, and delivery settings
- Origin: where CloudFront fetches uncached content from — an S3 bucket, ALB, API Gateway, or custom HTTP server
- Cache behavior: path-pattern-based rules (e.g. /api/* vs /images/*) each with their own cache/origin-request policy
- Cache policy: controls what becomes part of the cache key (headers, cookies, query strings) — the wider the key, the lower the hit rate
- Origin request policy: controls what additional information is forwarded to the origin on a cache miss
- Edge locations: CloudFront's worldwide points of presence that cache and serve content close to each viewer
- Viewer request
- leads to Nearest edge location (routed to)
- Nearest edge location — cache hit → served immediately
- leads to Cache behavior match (on a miss, matched by)
- Cache behavior match — by path pattern
- leads to Origin (S3, ALB, custom) (fetches from)
- Origin (S3, ALB, custom) — fetched only on a cache miss
Signature
Distribution → cache behavior → cache policy + origin request policy
Distribution ties origins + cache behaviors together. Cache policy = what varies the cache key. Origin request policy = what gets forwarded to the origin on a miss. Keep the cache key as narrow as the content actually requires.