Amazon CloudFront là dịch vụ CDN (Content Delivery Network) của AWS với hơn 450 edge locations trên toàn cầu; nó cache content (HTML, CSS, JS, images, video) tại edge gần người dùng, giảm latency và tải cho origin server.
- Cơ chế hoạt động: request đến edge location gần nhất → nếu cache HIT, trả về ngay; nếu cache MISS, fetch từ origin (S3, ALB, EC2, custom server) → cache lại theo TTL → trả về client.
- CloudFront hỗ trợ bảo mật: HTTPS end-to-end (TLS termination tại edge), Origin Access Control (OAC) để chỉ CloudFront mới access được S3 bucket (không expose S3 public), AWS WAF integration để filter request độc hại, Shield Standard miễn phí chống DDoS L3/L4, Shield Advanced cho L7 DDoS protection.
- Signed URLs/Cookies để restrict access cho nội dung premium.
- Cache behavior có thể cấu hình per path pattern (vd:
/api/không cache,/static/cache 1 năm). - CloudFront Functions và Lambda@Edge cho phép chạy code tại edge để modify request/response.
- Pricing dựa trên data transfer và request count.
Amazon CloudFront is AWS's CDN (Content Delivery Network) with over 450 edge locations worldwide; it caches content (HTML, CSS, JS, images, video) at edges close to users, reducing latency and load on the origin server.
- How it works: a request hits the nearest edge location → if cache HIT, content is returned immediately; if cache MISS, it fetches from the origin (S3, ALB, EC2, custom server), caches it per TTL, then returns to the client.
- CloudFront security features: end-to-end HTTPS (TLS termination at the edge), Origin Access Control (OAC) so only CloudFront can access the S3 bucket (keeping S3 private), AWS WAF integration to filter malicious requests, Shield Standard (free, automatic) for L3/L4 DDoS protection, and Shield Advanced for L7 DDoS protection.
- Signed URLs/Cookies restrict access to premium content.
- Cache behavior can be configured per path pattern (e.g.,
/api/not cached,/static/cached for 1 year). - CloudFront Functions and Lambda@Edge allow running code at the edge to modify requests/responses.
- Pricing is based on data transfer and request count.