Caching Flashcards
CloudFront Security
DDoS protections, AWS Shield, WAF
Cloudfront Ingress
Can upload to S3 even though S3 transfer acceleration will be more efficient
CloudFront HA
Has support for primary and secondary origins for failover
CloudFront S3 origin
Traffic goes through private aws network, faster
CloudFront EC2
- EC2 must be public, its SG needs to allow traffic from all edge location public ips.
- Traffic goes through public internet
CloudFront + ALB + EC2
- EC2 can be private, its SG needs to allow traffic ALB SG
- ALB is public, its SG needs to allow traffic from all edge location public ips.
- Traffic goes through public internet
CloudFront vs Cross Region Replication
CloudFront:
- Global Edge replication
- Files are cached for TTL
- Great for static content that must be available everywhere
S3 CRR:
- Must setup replication for each region
- Near real time replication
- Replication buckets are read only, source is only one
- Great for dynamic content that needs to be available at low latency in a few regions
CloudFront Geo Restriction
- Whitelist and Blacklist of countries that can(not) access content
- Country determined using 3rd party ip database
ClouFront signed URLs/Signed cookies
We attach a policy:
- URL expiration date
- IP ranges to access data from
- Trusted signers (which AWS accounts can create signed URLs)
Signed URL - access to one file
Signed Cooke - access to multiple files
CloudFront URL vs S3 Pre-signed URL
CloudFront:
- Allow access to a path no matter the origin (backend, s3)
- Account wide key-pair, only root can create signs URLs
- Can filter by ip, path, expiration, date
- Can leverage caching features
CloudFront Caching
Based on:
- Headers
- Session Cookies
- Query Parameters
Live on each edge location
TTL set by Header sent in response from origin:
- Control-Cache
- Expires
Lambda@Edge
- Lambda is deployed globally alongside CloudFront
- Can implement request filtering (using lambda) before reaching application
- Pay only for what you use
- Does not have any cache
CloudFront HTTPS configuration and Host
If Host header is not forwarded to origin, CloudFront will Host header with the value of the origin
ElasticCache
- Managed Redis or Memchached
- Involves heavy application code changes
- Must have invalidation strategy