How to set retention time using create-bucket API

0

The following link shows that I can enable object-locking during AWS create-bucket API commands:

https://awscli.amazonaws.com/v2/documentation/api/2.0.34/reference/s3api/create-bucket.html

But, where can I specify the retention time value?

Second, is there a way to only turn on retention without the versioning OR to set a retention value on an object during a create? I looked at put-objects and only see the expires field. I dont want the object store to remove the object when it hits the date...only ensure no one can delete it until that date. I dont really have support for versioning so this would be a better option.

LGood
질문됨 5달 전199회 조회
1개 답변
0

You need to use the separate put-object-lock-configuration command for that.

As to versioning, no, versioning is required to use object lock. You can set a retention value for an object during it's initial PUT. In the CLI this would be --object-lock-retain-until-date.

Keep in mind, with Object Lock, it does not prevent a delete command upon an object, but upon an object version. If you delete an object in an Object Lock bucket, a delete marker will be created. The actual object version that is protected by Object Lock will remain, can be restored or accessed directly using it's object version ID, and you will not be able to delete that object version.

As you can see, object versioning is critical to the use of Object Lock and will need be enabled to make use of the feature.

profile pictureAWS
답변함 4달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠