Cloudfront Flashcards
What is Amazon Cloudfront?
It is a Content Delivery Network (CDN). Improves read performance, content is cached at the edge.
DDos protection, integration with Shield, AWS Web Application Firewall
What can be the Origin for Cloudfront?
- S3 bucket
- ALB
- EC2 instance
- S3 website
- Any HTTP backend
What is the enhanched security between Cloudfront and S3?
THe Origin Access Control (OAC)
Describe Cloudfront az a high level.
Client requests a resource (GET /beach.jpg), then Cloudfront edge location checking if its in the local cache. If its there returns it, otherwise it will fetch from the server (origin)
What is the difference between Cloudfront and S3 Cross Region Replicas?
Cf:
* Global Edge network
* Files are cached for a TTL
* Great for static content that must be available everywhere
S3:
* Must setup for each region you want repplication
* Files are updated in near real-time
* Read only
* Great for dynamic content that needs to be available at low-latency in few regions
Describe Cloudfront caching.
- The cache lives at each CloudFront Edge Location
- CloudFront identifies each object in the cache using the Cache Key
- You want to maximize the Cache Hit ratio to minimize requests to the origin
- You can invalidate part of the cache using the CreateInvalidation API
What is CloudFront Cache Key?
- A unique identifier for every object in the cache
- By default, consists of hostname + resource portion of the URL
- You can add other elements (HTTP headers, cookies, query strings) to the Cache Key using CloudFront Cache Policies
List the different configurations for the Cloudfront Cache Policies.
Cache is based on
* HTTP Headers: None – Whitelist
* Cookies: None – Whitelist – Include All-Except – All
* Query Strings: None – Whitelist – Include All-Except – All
How can you control the TTL in Cloudfront cache policies?
Can be set by the origin using the Cache-Control header and Expires header.
What is sent to the origin if you applied Cloudfront Cache Policies?
All HTTP headers, cookies, and query strings that you include in the Cache Key are automatically included in origin requests
What is Cloudfront Origin Request Policy?
Specify values that you want to include in origin requests without including them in the Cache Key (no duplicated cached content).
What can you include in Cloudfront Origin Request Policy?
- HTTP headers: None – Whitelist – All viewer headers options
- Cookies: None – Whitelist – All
- Query Strings: None – Whitelist – All
Whats Cloudfront Cache Invalidations?
You can force an entire or partial cache refresh (thus bypassing the TTL) by performing a CloudFront Invalidation.
You can invalidate all files () or a special path (/images/).
What are Cloudfront Cache Behaviors?
Configure different settings for a given URL path pattern
* Use case: Route to different kind of origins/origin groups based on the content type or path pattern
* Default Cache Behavior is always the last to be processed and is always /
Whats a must if your Cloudfront distribution points to an EC2 instace?
- The instance must be public
- You have to allow ALL public IP of the edge locations