Kiểm soát truy cập trong Amazon S3
Khi nhiều team và đối tác cùng dùng một bucket, việc cấp quyền cần rõ ràng: ai được đọc, ai được ghi, và chỉ trong phạm vi nào.
Khi số lượng team và đối tác sử dụng dữ liệu tăng lên, việc cấp quyền cần được tổ chức gọn và rõ ràng. Chọn từng tình huống:
Bucket policy là resource-based policy, cho phép cấp quyền cho principal thuộc account khác.
ACL là cơ chế kiểm soát truy cập kiểu cũ của S3: mỗi bucket và object có một ACL gắn kèm dưới dạng subresource, xác định account hoặc group nào được cấp quyền và loại quyền. ACL không phải JSON policy như bucket policy hay trust policy của IAM role. Với Object Ownership = bucket owner enforced (mặc định), mọi ACL bị vô hiệu hoá, request đặt ACL thất bại với lỗi AccessControlListNotSupported, và quyền truy cập chỉ được quản lý bằng policy. AWS khuyến nghị giữ ACL ở trạng thái tắt, trừ khi cần kiểm soát quyền cho từng object riêng lẻ.
- Cấp quyền cho account khác: bucket policy (tối đa 20 KB).
- Cấp thêm quyền cho một nhóm IAM user trong cùng account: IAM group.
- Nhiều team, mỗi team một prefix: access point; access point không đổi đường mạng, truy cập S3 riêng tư từ VPC cần VPC endpoint (bài VPC, phần VPC endpoint).
- Giám sát toàn tổ chức: Storage Lens.
- Bucket mới sử dụng Object Ownership = bucket owner enforced, ACL bị tắt.
Access control in Amazon S3
When many teams and partners share one bucket, access must be clear: who may read, who may write, and within which scope.
As the number of teams and partners using the data grows, permissions need to be organized in a compact, clear way. Choose each scenario:
A bucket policy is a resource-based policy, which can grant permissions to principals in other accounts.
An ACL is S3’s legacy access control mechanism: every bucket and object has an ACL attached as a subresource that defines which AWS accounts or groups are granted access and the type of access. An ACL is not a JSON policy like a bucket policy or an IAM role trust policy. With Object Ownership = bucket owner enforced (the default), all ACLs are disabled, requests to set ACLs fail with the AccessControlListNotSupported error code, and access is managed only with policies. AWS recommends keeping ACLs disabled except when you need to control access to each object individually.
- Grant permissions to another account: bucket policy (up to 20 KB).
- Grant extra permissions to a set of IAM users in the same account: an IAM group.
- Many teams, one prefix each: access points; an access point does not change the network path, so private access to S3 from a VPC needs a VPC endpoint (VPC lesson, VPC endpoints).
- Organization-wide monitoring: Storage Lens.
- New buckets use Object Ownership = bucket owner enforced, with ACLs disabled.