1. Enable Versioning:
- Open the AWS S3 console or use the AWS CLI.
- Navigate to the desired S3 bucket.
- Select the "Properties" tab.
- Under "Advanced settings," enable versioning.
2. Enable Object Locking:
In the S3 console or using the AWS CLI:
- Navigate to the bucket properties.
- Under "Object Lock," enable Object Locking.
- Choose the desired retention settings or leave it unset for manual configuration.
3. Do Not Configure Default Retention Modes:
When enabling Object Locking, ensure that no default retention modes are configured unless specific retention requirements exist.
4. Create an S3 Bucket:
If the bucket does not exist:
- In the AWS S3 console, click "Create bucket."
- Follow the prompts to configure the bucket, enabling versioning and Object Locking.
5. Additional Required Permissions:
Grant the following IAM permissions to the user or role interacting with the S3 bucket:
- s3:GetBucketObjectLockConfiguration
- s3:GetObjectLegalHold
- s3:GetObjectRetention
- s3:PutBucketObjectLockConfiguration
- s3:PutObjectRetention
6. Reference Documentation:

Note: Enable Object Locking for an Existing Bucket:
- If the bucket already exists and Object Locking needs to be enabled:
- Follow steps 1 and 2 for the existing bucket without creating a new one.
- Adjust permissions and refer to the AWS documentation for any additional considerations.