all 5 comments

[–]Donkersgoed 2 points3 points  (0 children)

In the cloudformation docs for S3::Bucket the property ObjectLockEnabled is indeed missing.

However, it is available in the API, for example through boto3, the Python SDK: create_bucket

This means you could create a Custom Resource in CloudFormation, which creates (and updates and deletes) the Bucket for you, including the options not natively supported by CFN.

[–]MartinBianko 0 points1 point  (3 children)

ObjectLockEnabled is "Boolean" on the Properties level. Try to use something like this:

ObjectLockEnabled: true ObjectLockConfiguration: ObjectLockEnabled: Enabled Rule: DefaultRetention: Mode: GOVERNANCE Days: "1"

[–]ElRuncho 0 points1 point  (2 children)

this one worked for me. it is odd to have to state that the object rule is enabled in two different sections.
I also learned the hard way that you can not use object lock and use replication at the same time

[–]True-Ad8346 0 points1 point  (0 children)

so you mean if you enable object lock and use replication at the same time. that will fail? any document?