So sánh các thiết lập CloudFront có tên gần nhau
Nhiều thiết lập của CloudFront có tên gần giống nhau; phân biệt được chúng giúp chọn đúng thiết lập cho từng yêu cầu.
Một số thiết lập của CloudFront có tên gần với yêu cầu thực tế nhưng giải quyết một vấn đề khác. Chọn từng mục để xem trường hợp sử dụng, lý do không phù hợp trong tình huống MFTECH tương ứng, và phương án nên chọn:
Giới hạn tập edge location phục vụ distribution theo mức giá tối đa chấp nhận được: PriceClass_100, PriceClass_200 hoặc PriceClass_All. Mặc định CloudFront phục vụ từ edge location ở mọi khu vực. Với price class khác PriceClass_All, CloudFront phục vụ từ edge location có độ trễ thấp nhất trong price class; người dùng ở khu vực bị loại có thể gặp độ trễ cao hơn.
MFTECH cần phục vụ ảnh từ S3 và API từ ALB trên cùng một distribution, đồng thời có origin dự phòng. Price class chỉ liên quan tới chi phí và tập edge location, không định tuyến request tới origin.
Phương án phù hợpCache behavior theo path pattern (/images/* tới S3, /api/* tới ALB) và origin group cho failover (phần 3).
- Price class quyết định chi phí và tập edge location, không định tuyến origin.
- Origin request policy quyết định thông tin gửi tới origin, không cấp quyền.
- HTTPS tới origin bảo vệ đường truyền, không giới hạn người xem.
- Lambda@Edge tuỳ biến request/response tại edge, không tạo tính sẵn sàng cao cho ứng dụng và database.
- CloudFront không có xác thực Cognito dựng sẵn: xác thực tại edge cần Lambda@Edge; cách ít code nhất là để ALB phía sau xác thực bằng Cognito user pool (bài ELB).
CloudFront settings with similar names compared
Many CloudFront settings have similar names; telling them apart helps you pick the right one for each requirement.
Some CloudFront settings have names close to a real requirement but solve a different problem. Select each item to see when to use it, why it does not fit the matching MFTECH situation, and what fits instead:
Limits the set of edge locations that serve the distribution to the maximum price you want to pay: PriceClass_100, PriceClass_200 or PriceClass_All. By default CloudFront serves from edge locations in all regions. With a price class other than PriceClass_All, CloudFront serves from the lowest-latency edge location within the price class; viewers in excluded regions may see slower performance.
MFTECH must serve images from S3 and the API from an ALB in one distribution, with a standby origin. A price class only concerns cost and the set of edge locations; it does not route requests to origins.
Phương án phù hợpCache behaviors by path pattern (/images/* to S3, /api/* to the ALB) and an origin group for failover (part 3).
- A price class sets cost and the set of edge locations; it does not route to origins.
- An origin request policy decides what is sent to the origin; it grants no permission.
- HTTPS to the origin protects data in transit; it does not restrict viewers.
- Lambda@Edge customizes requests and responses at the edge; it does not make the application and database highly available.
- CloudFront has no built-in Cognito authentication: authenticating at the edge needs Lambda@Edge; the least-code option is letting the ALB behind it authenticate with a Cognito user pool (ELB lesson).