Use this when objects must not be deleted or overwritten before a date.
Immutability
Object immutability (S3 Object Lock) prevents objects from being overwritten or deleted until a retention date. Compliance mode cannot be bypassed even by root, while governance mode allows privileged override.
1. Object Lock (WORM) prevents deletion for a retention period.
2. Governance (bypass with permission) vs Compliance (no bypass).
3. Must be enabled at bucket creation (S3).
4. Key for ransomware-resistant backups.
5. Test restores.
object PUT → retention set → deletes refused until expiry
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Common mistakes Narrow the fault
- Compliance mode with a retention far too long.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Object lock needs versioning.
- Compliance mode cannot be bypassed.
- Governance mode allows privileged override.
aws s3api get-object-lock-configuration --bucket <b>— lock mode/retentionaws s3api get-object-retention --bucket <b> --key <k>— per-objectaws s3api get-object-legal-hold --bucket <b> --key <k>— legal hold
ReferenceHow it works1 section · depth on demand
Reference
aws s3api get-object-lock-configuration --bucket backups
aws s3api get-object-retention --bucket backups --key file
ReferenceImportant terms & boundaries3 sections · depth on demand
In depth
Immutability: data that cannot be changed or deleted until a date
Immutable storage follows the write-once-read-many (WORM) model. For object storage, S3 Object Lock is the common API. MinIO and Ceph RGW implement it too.
Object Lock as documented by AWS
| Point | Detail |
|---|---|
| Prerequisite | Versioning enabled; locks apply to a specific object version |
| Retention period | Protects a version until a retain-until date; can be extended, never shortened |
| Legal hold | No expiry; stays until removed by someone with s3:PutObjectLegalHold |
| Governance mode | Users with s3:BypassGovernanceRetention can override it with the bypass header |
| Compliance mode | No user, including root, can delete the version, change its mode or shorten retention |
| Deletes | Permanent delete of a locked version returns 403; a simple delete only adds a delete marker |
$ aws s3api create-bucket --bucket backups-worm --object-lock-enabled-for-bucket
$ aws s3api put-object-lock-configuration --bucket backups-worm --object-lock-configuration \
'{"ObjectLockEnabled":"Enabled","Rule":{"DefaultRetention":{"Mode":"GOVERNANCE","Days":30}}}'
$ aws s3api get-object-retention --bucket backups-worm --key restic/data/3f/3fa1... --version-id <id>
{ "Retention": { "Mode": "GOVERNANCE", "RetainUntilDate": "2026-12-27T01:00:00Z" } }
Choosing the mode
| Mode | Fits |
|---|---|
| Governance | Ransomware protection with an emergency override for named admins; testing settings |
| Compliance | Regulatory retention where nobody may delete early |
Compliance mode is effectively permanent for its period. AWS notes that the only way to remove such objects early is to close the account. Test with governance mode and short periods first.
Backup integration
- Retention in the lock must cover the backup tool's retention. Otherwise prune jobs fail on locked objects.
- Tools need to support immutable targets. Check how they handle forget, prune and locks.
- Immutability protects against deletion through the storage API. Credentials and the account itself still need separate protection (MFA, separate admin accounts).
Documented example, not captured output.
How it works
Object Lock stores objects in WORM mode: in governance mode privileged users can override retention, in compliance mode nobody can delete or shorten retention until it expires. Used to protect backups from ransomware.
Reference
| Mode | Can be shortened/removed by |
|---|---|
| Governance | Users with s3:BypassGovernanceRetention |
| Compliance | Nobody, including root |
| Legal hold | Until removed, no expiry date |
Object lock must be enabled when the bucket is created (AWS).
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Object Storage → Immutability. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.snia.org/tech_activities/standards/curr_standards/cdmi · confidence 94%