Amazon Simple Storage Service (Amazon S3)
AWS S3 Basic Features
Demo Versioning
In this tutorial, you’ll explore how Amazon S3’s versioning feature affects object uploads, overwrites, and deletions. We’ll walk through three key states—versioning disabled, enabled, and suspended—and demonstrate how you can recover or permanently remove object versions.
Versioning Disabled
With versioning disabled, any object you delete is permanently removed and cannot be recovered. Overwrites simply replace the existing object.
- Create a new S3 bucket named Versioning Demo, leaving Bucket Versioning turned off and all other settings at their defaults.
Locally create a file
file1.txt
with:this is version 1
- Upload
file1.txt
to your bucket (all defaults).
Open file1.txt in the console to confirm it shows:
this is version 1
Permanent Delete when Disabled
Select file1.txt → Delete → type permanently delete to confirm.
Warning
Deleting objects in a bucket with versioning disabled removes them forever—there is no undelete or version history.
- Re-upload the same
file1.txt
(version 1) to restore it.
- Overwrite when Disabled
Editfile1.txt
to:
Upload using the same key. Version 1 is lost permanently because versioning is disabled.this is version 2
Enabling Versioning
Enable versioning to retain every object change with a unique Version ID. You can recover or permanently delete specific versions.
- In the bucket Properties, click Edit under Bucket Versioning, select Enable, and Save.
Upload
file1.txt
with the original content:this is version 1
In the Objects view, check Show versions to reveal version history. Each version entry displays a unique Version ID.
Confirm version 1 content:
this is version 1
Adding More Versions
- Version 2: Update locally to
this is version 2
and upload again. - Version 3: Change to
this is version 3
and upload once more.
Each upload creates a new version entry. You can open each one to verify content and timestamps.
Delete with Versioning Enabled
Deleting an object now places a delete marker rather than removing prior versions.
- Select file1.txt → Delete → type delete (no “permanently delete” prompt).
- The object disappears, but Show versions reveals:
- A new Delete marker
- All three prior versions
- Restoring: Remove the delete marker by selecting it and choosing Delete → type permanently delete.
Permanently Deleting Specific Versions
You can delete individual versions without affecting others. Select a version (e.g., version 2) → Delete → type permanently delete. Only that version is removed.
Suspending Versioning
Once turned on, you can only suspend versioning, not disable it. Suspended state retains old versions but assigns null
as the Version ID for new uploads.
- In Properties → Bucket Versioning, click Suspend and Save.
- Existing versions remain accessible. New uploads use a
null
Version ID.
- Upload version 4 (
this is version 4
) and version 5 (this is version 5
). Both appear withnull
Version IDs.
New Objects under Suspension
- Create
file2.txt
withthis is version 1
and upload—it getsnull
ID. - Update to
this is version 2
—the previousnull
version is replaced.
MFA Delete
In the Bucket Versioning settings, you’ll see MFA Delete. Enabling this feature (via CLI or SDK) requires multi-factor authentication to change or delete versions. It cannot be turned on in the console.
Versioning States Overview
Versioning State | New Upload Behavior | Recoverability |
---|---|---|
Disabled | Overwrites existing objects | No history, permanent deletes |
Enabled | New versions with unique IDs | All versions retained; delete markers available |
Suspended | null Version ID on uploads | Existing versions kept; new uploads overwrite |
Cleanup
To tear down:
- In Objects, enable Show versions.
- Select all versions and markers → Delete → type permanently delete.
- Delete the bucket.
Links and References
Watch Video
Watch video content
Practice Lab
Practice lab