Object Lock stops a locked object version from being overwritten or deleted. Read Object Lock first: you can turn it on only when you create the bucket, so decide before you create it.
Turn on Object Lock when you create the bucket
Section titled “Turn on Object Lock when you create the bucket”On the bucket creation form, check Enable Object Lock. This also turns on Object Versioning, since a lock only protects a version. Click Create Bucket.
Set a default retention policy
Section titled “Set a default retention policy”Open the bucket’s Object Lock tab, set a retention period in days (1 to 36,500), select Governance (the only lock mode available today) as the lock mode, and save. Every object uploaded to this bucket from then on inherits this retention period automatically.
Lock or unlock one version
Section titled “Lock or unlock one version”On the Objects tab, click View All Versions, open the version’s menu, and select Lock Settings. From there:
- Turn on Governance Lock to set a retention period on this one version, or remove it early. As the bucket’s owner, you can shorten or clear a Governance Lock before it expires.
- Turn on Legal Hold for an indefinite hold with no expiry; turn it off yourself when it is no longer needed.
Before you delete a locked bucket
Section titled “Before you delete a locked bucket”To delete a bucket with a default lock policy, remove the policy first. Once it is gone, locked objects on their own no longer hold the delete back. A version under Governance Lock can still be deleted early if you, as the owner, clear or shorten the lock first; a version under Legal Hold can be deleted once you turn the hold off. See Troubleshooting E2E Object Storage if a delete is blocked.
For when to use Governance Lock and when to use Legal Hold, see Object Lock.