Home > Net >  boto3 : Create a S3 bucket with ACLs disabled
boto3 : Create a S3 bucket with ACLs disabled

Time:06-17

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

CodePudding user response:

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.

  • Related