Overview
A CloudFront distribution is a configuration that connects your content's origin server (e.g., S3 bucket, EC2 instance, or custom origin) to the global network of CloudFront edge locations. It governs how content is cached, delivered, and secured.
Key Features of Distributions
- Origins
- Behaviors
- Cache Settings
- Custom Error Responses
- SSL/TLS Certificates
- Geo-Restrictions
- Access Control (Signed URLs and Cookies)
1. Origins
- Specifies the source of the content served by CloudFront.
- Example:
- An e-commerce site hosts product images in an S3 bucket.
- Origin configuration specifies the bucket URL (
s3://product-images.example.com) as the source.
- CloudFront retrieves and caches the images for faster delivery.
2. Behaviors
- Control how CloudFront processes requests for different URLs.
- Includes caching policies, path-based routing, and HTTP/HTTPS protocol enforcement.
- Example:
- A site’s homepage (
/) and product pages (/products/*) have different caching needs.
- Behavior 1: Cache the homepage for 5 minutes.
- Behavior 2: Cache product pages for 24 hours.
3. Cache Settings