S3 AWS CDK 的 access_control 和 public_read_access 有什么区别?
What's the difference between access_control and public_read_access for S3 AWS CDK?
我是 CDK 的超级新手,我想知道以下选项之间的区别是什么:
access_control=s3.BucketAccessControl("PUBLIC_READ")
VS
public_read_access=True
使用这两个选项是否多余?
site_bucket = s3.Bucket(
self,
"site-bucket",
access_control=s3.BucketAccessControl("PUBLIC_READ"),
public_read_access=True,
website_index_document="index.html",
versioned=True,
removal_policy=core.RemovalPolicy.DESTROY,
auto_delete_objects=True
)
access_control
将 canned ACL 应用于存储桶。
public_read_access=True
等同于调用site_bucket.grant_public_access()
。将存储桶策略更新为 allow any principal to read objects in the bucket.
我是 CDK 的超级新手,我想知道以下选项之间的区别是什么:
access_control=s3.BucketAccessControl("PUBLIC_READ")
VS
public_read_access=True
使用这两个选项是否多余?
site_bucket = s3.Bucket(
self,
"site-bucket",
access_control=s3.BucketAccessControl("PUBLIC_READ"),
public_read_access=True,
website_index_document="index.html",
versioned=True,
removal_policy=core.RemovalPolicy.DESTROY,
auto_delete_objects=True
)
access_control
将 canned ACL 应用于存储桶。
public_read_access=True
等同于调用site_bucket.grant_public_access()
。将存储桶策略更新为 allow any principal to read objects in the bucket.