The option "---no-object-lock-enabled-for-bucket" does not work with AWS CLI:The created bucket has always all public access blocked!


When I create a bucket using the AWS CLI, it has by default "block public access". When trying to create a bucket having public access enabled: I used the option from the documentation : "--no-object-lock-enabled-for-bucket", but it turns out that also with the opposite option "object-lock-enabled-for-bucket", the public access is always disabled ! Here 2 screenshots commands Enter image description here and here the results (as you see: "Bucket and objects not public" ! Enter image description here

1 Answer
Accepted Answer

You are using the wrong option. ---no-object-lock-enabled-for-bucket set S3 Object Lock behavior for the bucket.

To adjust the Block Public Access use put-public-access-block.

profile pictureAWS
answered 13 days ago
  • by default when creating a bucket (the public access is blocked)! I want an option to do the opposite thing, so I added --no-object-lock-enabled-for-bucket or even --object-lock-enabled-for-bucket (but it has no effect), the access remains blocked! (just try it et you will see: it is odd!) that with the AWS command line , this option is obselete (but still exsists in the documentation). To get a bucket wiht open public access (not blocked), I have to do 2 commands :

    $ aws s3api create-bucket --bucket abir-devops --region eu-west-3 --create-bucket-configuration LocationConstraint=eu-west-3 Then 2nd command (since by default the public access is blocked, when creating the bucket) $ aws s3api delete-public-access-block --bucket abir-devops ==> My question: whay this option is still in the documentation : ---no-object-lock-enabled-for-bucket or object-lock-enabled-for-bucket: but without any effect ! they are obselete!

  • Because S3 Object Lock is a different thing than Block Public Access. They do two different things.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions