
- Lower latency and faster page loads
- Reduced load on origin servers
- Built-in HTTPS and integration with IAM/ACM
- Metrics via Amazon CloudWatch

- Amazon S3 buckets (static assets like images, CSS, JS)
- Application Load Balancers (ALB) serving dynamic content
- EC2 instances or any HTTP(S) server (custom origin)
CloudFront pulls content from the origin when a requested object is not cached at the edge, and then caches it for subsequent requests.
Distribution
A CloudFront distribution is the configuration object that ties origins to edge locations and defines cache behavior, security, SSL settings, and more. When you create a distribution you:
- Specify one or more origins
- Configure cache behaviors, TTLs, and path patterns
- Associate an SSL/TLS certificate for custom domains (optional)
xyz.cloudfront.net. The distribution configuration is propagated to edge locations so they know how to fetch content from the origin.
Request flow:
- If the requested object is cached at the edge location, CloudFront returns it immediately.
- If the object is not cached, the edge location requests it from the origin, returns the response to the client, and caches it for subsequent requests.

- CloudFront respects
Cache-ControlandExpiresheaders returned by the origin by default. - If no caching headers are present, CloudFront’s default TTL is 24 hours.
- You can configure
MinimumTTL,DefaultTTL, andMaximumTTLin the distribution’s cache behavior to override origin headers.
- Short TTLs for frequently changing content (APIs, JSON, small assets)
- Long TTLs for versioned static assets (hashed filenames for cache-busting)

- Object (version 1) is cached at edge locations per TTL.
- You update the object at the origin (version 2).
- Without invalidation, edge caches continue serving version 1 until the TTL expires.
- An invalidation removes the specified objects from edge caches; the next request triggers a fetch of version 2 from the origin.
- Specific object:
/images/logo.png - Folder or pattern:
/images/* - Entire distribution:
/*
- Use versioned object names (e.g.,
app.v2.js) for cache-busting — generally cheaper and avoids invalidation overhead.

For many release workflows, prefer versioned file names (cache-busting) instead of frequent invalidations. Versioned filenames avoid cache churn and typically reduce costs and propagation delay.
Cache invalidations can temporarily impact performance while edge caches repopulate and may incur charges depending on volume. Plan invalidations sparingly and prefer versioning when possible.
- CloudFront supports HTTPS by default and provides a default certificate for
*.cloudfront.net. - To use a custom domain (for example
https://example.com), request/import an SSL/TLS certificate via AWS Certificate Manager (ACM) and attach it to the distribution. - Important: ACM certificates used with CloudFront must be created in the US East (N. Virginia) region (
us-east-1).

- Request count
- Bytes transferred
- Error rates (4xx/5xx)
- Cache hit/miss metrics


- Amazon CloudFront is a global CDN that reduces latency by caching content at edge locations.
- Origins (S3, ALB, EC2, or custom HTTP servers) are the source of truth for objects CloudFront caches.
- A CloudFront distribution ties origins to cache behaviors and assigns a
*.cloudfront.netdomain name. - TTL controls cache freshness (CloudFront default: 24 hours if no caching headers are present). Use
Cache-Controlheaders for finer control. - Cache invalidation forces eviction of objects from edge caches, but consider versioned filenames to avoid frequent invalidations.
- CloudFront integrates with ACM for custom certificates (ACM certs for CloudFront must be in
us-east-1) and emits metrics to CloudWatch.
- Amazon CloudFront Documentation
- AWS Certificate Manager (ACM)
- Monitoring CloudFront with CloudWatch
- AWS CLI — create-invalidation