Giới hạn truy cập origin S3 thông qua CloudFront
Khi nội dung được phân phối qua CloudFront, mọi truy cập nên đi qua CloudFront; nếu người dùng đọc thẳng được bucket S3 thì các lớp kiểm soát đặt tại CloudFront bị bỏ qua.
Khi bucket được cấu hình public, client có thể truy cập trực tiếp S3 endpoint và bỏ qua toàn bộ lớp kiểm soát tại CloudFront (cache, AWS WAF, geo restriction). Các phương án cấu hình được so sánh dưới đây:
- Bucket ở chế độ private; OAC (hoặc OAI) kết hợp bucket policy đảm bảo chỉ CloudFront truy cập được origin.
- Giới hạn theo IP hoặc quốc gia được thực hiện bằng AWS WAF gắn với CloudFront distribution.
Restricting access to the S3 origin through CloudFront
When content is delivered through CloudFront, every access should go through it; if users can read the S3 bucket directly, the controls placed at CloudFront are bypassed.
When the bucket is configured as public, clients can access the S3 endpoint directly and bypass every control layer at CloudFront (cache, AWS WAF, geo restriction). The configuration options are compared below:
- The bucket stays private; OAC (or OAI) combined with a bucket policy ensures that only CloudFront can access the origin.
- Restrictions by IP or by country are implemented with AWS WAF associated with the CloudFront distribution.