ambb
ambb

Reputation: 63

boto3 : Create a S3 bucket with ACLs disabled

I am trying to create a new bucket on S3 using boto3 and python. However, I want its ACLs to be disabled. I have tried the following code, but ACLs are still enabled. How can I disable ACLs using boto3?

s3.create_bucket(
    Bucket = BUCKET_NAME,
    CreateBucketConfiguration = {
        'LocationConstraint': REGION_NAME
    },
    ACL='private'
)

enter image description here

Upvotes: 0

Views: 742

Answers (1)

jarmod
jarmod

Reputation: 78573

The create_bucket SDK does not control Object Ownership.

I think that you need to indicate the BucketOwnerEnforced rule when calling put_bucket_ownership_controls, after the bucket has been created.

Upvotes: 1

Related Questions