Use this when objects need recoverable history.
Object Versioning
Object versioning keeps every version of an object when it is overwritten or deleted, so earlier versions can be restored. Deletes add a delete marker, and old versions still use space until lifecycle rules expire them.
1. Versioning keeps previous versions and delete markers.
2. Protects against overwrite/delete.
3. Costs storage — combine with lifecycle (noncurrent expiration).
4. Can be suspended, not disabled.
5. Restore by copying an old version.
PUT/DELETE → new version/delete marker
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
- Versioning without lifecycle rules, so storage grows forever.
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.
- Every overwrite or delete keeps a version.
- Delete adds a delete marker.
- Old versions use space until expired.
aws s3api get-bucket-versioning --bucket <b>— statusaws s3api list-object-versions --bucket <b> --prefix <k>— versionsaws s3api put-bucket-versioning --bucket <b> --versioning-configuration Status=Enabled— enable
ReferenceHow it works1 section · depth on demand
Reference
Restore an old version by copying it over the current one: aws s3api copy-object --bucket b --key f --copy-source b/f?versionId=<id>.
ReferenceImportant terms & boundaries3 sections · depth on demand
In depth
Versioning keeps every version of every object
The AWS S3 documentation describes three bucket states: unversioned (the default), versioning-enabled and versioning-suspended. Once enabled, versioning can only be suspended, never returned to unversioned. Every new object version gets a unique version ID. Objects that existed before have the version ID null.
$ aws s3api put-bucket-versioning --bucket backups-prod --versioning-configuration Status=Enabled
$ aws s3api get-bucket-versioning --bucket backups-prod
{ "Status": "Enabled" }
$ aws s3api list-object-versions --bucket backups-prod --prefix db/app.dump
{ "Versions": [ { "Key": "db/app.dump", "VersionId": "3HL4kqtJlcpXroDTDmJ+rmSpXd3dIbrH", "IsLatest": true }, ... ],
"DeleteMarkers": [] }
$ aws s3api get-object --bucket backups-prod --key db/app.dump --version-id <older-id> app.dump.old
Behaviour (AWS documentation)
| Action | Result |
|---|---|
| Overwrite | New version; the previous one stays as noncurrent |
| Delete without a version ID | A delete marker becomes the current version; data remains |
| Delete with a version ID | That version is permanently removed |
| Cost | Every version is a full stored copy and is billed |
Use lifecycle rules with versioning
AWS recommends combining versioning with lifecycle rules. When moving from an unversioned bucket with an expiration rule, add a noncurrent version expiration, or old versions are never removed.
Recovery uses
- Undo an accidental overwrite: copy the previous version back as current.
- Undo a delete: remove the delete marker.
- Ransomware that overwrites objects creates new versions, so older ones stay recoverable. That holds only if the attacker cannot delete versions; for that, combine versioning with Object Lock.
S3-compatible systems (MinIO, Ceph RGW) support the same API, but check their version-specific behaviour.
Documented example, not captured output.
Quick reference
With versioning enabled, every overwrite creates a new version and a delete adds a delete marker instead of removing data. Older versions remain until a lifecycle rule expires them, so storage use grows. Versioning is required for replication and object lock.
aws s3api put-bucket-versioning --bucket backups --versioning-configuration Status=Enabled
aws s3api list-object-versions --bucket backups --prefix db/
Reference
aws s3api put-bucket-versioning --bucket b --versioning-configuration Status=Enabled
aws s3api list-object-versions --bucket b --prefix file
Documented example, not captured output. Deletes create delete markers; old versions remain until lifecycle rules expire them.
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 → Object Versioning. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.snia.org/tech_activities/standards/curr_standards/cdmi · confidence 94%