Note: Object lock on a bucket can only be enabled when the bucket is created.
When applying object lock to a bucket, you can then enable compliance mode to set a retention period to its contents. Additionally, when object lock is applied, legal hold can be set on a version of an object. See Setting legal hold on a version of an object.
To create a bucket with object lock: