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

0

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 年前檢視次數 198 次
1 個回答
0
已接受的答案

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
專家
kentrad
已回答 1 年前
profile picture
專家
已審閱 8 天前
  • 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.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南