简体   繁体   中英

What's the difference between access_control and public_read_access for S3 AWS CDK?

I'm super new to CDK and I'm wondering what the difference is between the following options:

access_control=s3.BucketAccessControl("PUBLIC_READ")

VS

public_read_access=True

Is using both options redundant?

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 applies a canned ACL to the bucket.

public_read_access=True is the same as calling site_bucket.grant_public_access() . Updates the bucket policy to allow any principal to read objects in the bucket .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM