
Episode 14: Content Delivery & Global Apps - CloudFront, Caching Strategies & Latency Optimization | SAA-C03
Notas do episódio
Master CloudFront! CDN fundamentals, caching strategies, and CloudFront vs Global Accelerator in under 40 minutes.
🚀 WHY CDNs MATTER
A user in Tokyo hitting a server in Virginia waits 300-400ms per round trip. A CDN caches content at hundreds of edge locations close to users, dropping latency to milliseconds. CloudFront also provides DDoS protection (Shield + WAF) and reduces origin load.
🌐 CLOUDFRONT ORIGINS
• S3 BUCKET: Secure with Origin Access Control (OAC). Bucket stays private, only your distribution can read it.
• VPC ORIGIN: Deliver from private subnets (ALB/NLB/EC2) without internet exposure
• CUSTOM ORIGIN: Any public HTTP backend. Restrict with security groups using CloudFront IPs.
📦 HOW CACHING WORKS
• CACHE HIT: Served from edge in milliseconds
• CACHE MISS: CloudFront fetches from origin, caches locally
• TTL controls cache duration
• Cache behaviors apply different rules to different URL paths
• Cache keys identify objects (URL + optional headers/cookies/query strings)
🎯 CACHING STRATEGIES
• Static (images, CSS, JS): Cache aggressively (1 day+)
• Dynamic (news, listings): Short TTLs (60s-5min) still give massive gains
• Personalized: TTL=0 but still benefits from AWS backbone + DDoS protection
🔄 CACHE INVALIDATION
Force refresh before TTL. Use wildcards or paths. First 1,000 paths/month free. Better: version filenames (style-v2.css).
🔒 SECURITY
• GEO RESTRICTION: Allowlist/blocklist by country
• SIGNED URLs: Time-limited access to ONE file
• SIGNED COOKIES: Authorize access to MANY files
• WAF integration: Block attacks at the edge
🆚 CLOUDFRONT vs S3 CROSS-REGION REPLICATION
CloudFront: Cached static content globally, TTL-based
CRR: Actual replicas in specific regions, near real-time, dynamic content
🆚 CLOUDFRONT vs GLOBAL ACCELERATOR (heavily tested!)
CLOUDFRONT:
• HTTP/HTTPS only, caches at edge
• IPs change (DNS-based)
• Best: static + dynamic web content
GLOBAL ACCELERATOR:
• Any TCP/UDP, no caching - proxies to origin
• 2 STATIC anycast IPs (never change!)
• Fast regional failover under 1 minute
• Best: gaming (UDP), IoT (MQTT), VoIP, firewall whitelisting, multi-region failover
KEYWORD TRIGGERS:
"Gaming" "UDP" "static IP" "regional failover" → Global Accelerator
"HTTPS" "caching" "static content" "global users" → CloudFront
⚡ EDGE COMPUTING
CLOUDFRONT FUNCTIONS: JavaScript, sub-ms startup, millions/sec. Limited: <1ms execution, 2MB memory, no network. Use for cache key normalization, headers, URL rewrites, simple auth.
LAMBDA@EDGE: Node.js/Python, 5-10s execution, up to 10GB memory, network + file system access. Use for image resizing, AWS SDK calls, complex auth. 6x more expensive than CloudFront Functions.
⚠️ TOP EXAM TRAPS
• Use Origin Access Control (NOT public S3) for security
• CloudFront = HTTP/S only; Global Accelerator = static IPs
• Signed URLs = one file; Signed cookies = many files
• Frequent invalidations expensive → version filenames
• VPC Origins for private backends
• Geo Restriction is built-in (no custom code)
• CloudFront Functions vs Lambda@Edge: scale vs power
🏗️ REAL ARCHITECTURES
1. Static site: CloudFront + S3 with OAC = serverless global website
2. Add API: CloudFront routes /api/* to API Gateway + Lambda + DynamoDB
3. Global app: + DynamoDB Global Tables for multi-region
4. Photo app: CloudFront for uploads (Transfer Acceleration) and downloads
⏱️ TIMESTAMPS
00:00 Intro | 01:30 Why CDNs | 04:00 Origins | 08:00 Caching | 13:00 Invalidation | 15:00 Security | 17:30 vs CRR | 20:00 vs Global Accelerator | 24:00 Edge Computing | 28:00 Architectures | 32:00 Exam Traps | 39:00 Conclusion
Perfect for SAA-C03 prep and building globally distributed apps!
#AWS #CloudFront #CDN #GlobalAccelerator #SolutionsArchitect #SAAC03 #CloudComputing
⭐ 5-star rating if this helps!