Topic lessonTopic: S3: versions, retention, replication and cost
S3 Versioning explained: overwrites, deletes and recovery
S3 Versioning retains multiple versions of an object with the same key. Separate storing a new version, changing what an ordinary read sees, and permanently removing a particular version. Follow one internal report through an overwrite and a delete.
Distinguish keys, version IDs, current and noncurrent versions, and delete markers; explain overwrites and deletes in enabled, suspended and unversioned buckets.
Know buckets, keys and objects. The example uses a versioning-enabled general purpose bucket with the necessary permissions and read conditions satisfied. vA, vB and M1 are teaching labels, not real version-ID formats or timestamps. No operation is executed.
One key can retain several data versions
A key names an object; a version ID identifies one version under that key. With versioning enabled, writing reports/monthly.pdf again adds a version. The previous content remains as a noncurrent version rather than being overwritten.
Store the first report
PUTA PUT creates version vA.
- Draft A
vACurrent
Ordinary read: draft A
Write the finished report
PUTA PUT adds vB; vA remains.
- Final B
vBCurrent - Draft A
vANoncurrent
Ordinary read: final B
Delete without a version ID
DELETEAdd marker M1 without removing data.
- Delete marker: no data
M1Current - Final B
vBNoncurrent - Draft A
vANoncurrent
Ordinary read: appears deleted
Read version vA explicitly
GET · versionId=vAA GET does not change version order.
- Delete marker: no data
M1Current - Final B
vBNoncurrent - Draft A: the requested version
vANoncurrent
Explicit version read: draft A
History under one key. Distinguish data versions from delete markers, which have no object data.
Choose an option to see the result and explanation.
Choose between the latest version and an explicit version
A delete marker is a version without object data. When it is current, a GET without a version ID sees the object as deleted. Draft A and final B remain stored in this example and can be requested by version ID when the required conditions are met.
| Request | Target and result in this example |
|---|---|
| GET without versionId | Current M1; treated as deleted, with 404 |
| GET with versionId=vA | Data version vA; reads draft A |
| GET with versionId=M1 | The marker itself has no data; 405 |
Check the permission distinction too: s3:GetObjectVersion for an explicit version and s3:GetObject for a current-version read without versionId. Knowing a key or reading its current version does not by itself establish access to older versions. Match the principal, target and permissions before interpreting a real 403 or 404.
Choose an option to see the result and explanation.
Deletion target: add a marker or remove a particular version
| Request | Change in this fixed example |
|---|---|
| DELETE without versionId | Adds a new delete marker; retains data versions |
| DELETE with versionId=vB | Permanently removes vB; adds no new marker |
| DELETE with versionId=M1 | Removes marker M1; the next newest retained version becomes current |
Repeating DELETE without versionId does not remove current marker M1: it adds another marker. Even after removing a specified marker, another marker below it can keep the object hidden. Reason from the versions that actually remain.
Choose an option to see the result and explanation.
Suspending does not return the bucket to its unversioned state
| State | Next write to the same key |
|---|---|
| Unversioned | Version ID is null; replaces existing content |
| Enabled | Adds a version with a new version ID |
| Suspended | Writes a null version; replaces any null version of that key |
Objects that predate enabling versioning retain their null version IDs. An enabled bucket cannot return to the unversioned state; suspension changes later writes. Existing non-null versions are retained. If draft C and then revision D are written under the same key while suspended, D replaces the null version containing C.
While suspended, DELETE without versionId removes any null version under that key and inserts a null delete marker. If no null version exists, the non-null data versions remain and a marker is inserted. Do not assume that suspension preserves all data as an enabled bucket does.
Choose an option to see the result and explanation.
Plan retention, read permissions and cost together
Each stored version contains the whole object, not just its differences. Keeping draft A and final B means accounting for both. Delete markers also incur a small storage charge. Disappearing from an ordinary listing does not establish zero stored data.
- Fix the key, bucket versioning state and operation time.
- Separate PUT/GET/DELETE and the presence of versionId; identify the current and retained data versions.
- Check the required older version and read permission, then review permanent deletion and Lifecycle separately.
- Choose retention and stored volume together with cost and deletion-protection conditions.
Check, then explain in your own words
- Explain keys and version IDs.
- Identify markers/data and current/noncurrent versions in the figure.
- Compare the next operation in enabled, suspended and unversioned states.
- Review retention, permissions, Lifecycle and cost together.
Check your understanding: If the current version is a delete marker, is all the data gone?
No. Distinguish retained data versions from permanently removed versions.
What an ordinary read sees is not the whole stored history. Match version IDs, bucket state, operations and applicable retention/deletion controls.
Sources and conditions checked
The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.
- How S3 Versioning worksChecked:
Scope and conditionsPUT/GET/DELETE workflows; opaque version IDs; whole-object storage per version
Used in this lessonOne key can retain several data versions Choose between the latest version and an explicit version Plan retention, read permissions and cost together
- Working with delete markersChecked:
Scope and conditionsNo-data marker; current versus explicit marker GET; listing and storage charges
Used in this lessonOne key can retain several data versions Choose between the latest version and an explicit version Plan retention, read permissions and cost together
- GetObject API referenceChecked:
Scope and conditionsGeneral purpose bucket permissions and version-targeted retrieval; no request executed
Used in this lessonChoose between the latest version and an explicit version
- DeleteObject API referenceChecked:
Scope and conditionsEnabled/suspended/unversioned behavior; s3:DeleteObjectVersion; directory-bucket boundary
Used in this lessonDeletion target: add a marker or remove a particular version Suspending does not return the bucket to its unversioned state
- Managing delete markersChecked:
Scope and conditionsRemove a marker by version ID; repeated DELETE without versionId adds markers in a versioning-enabled bucket; expired markers
Used in this lessonDeletion target: add a marker or remove a particular version
- Deleting object versionsChecked:
Scope and conditionsVersion-targeted permanent deletion and noncurrent expiration; not a real delete operation
Used in this lessonDeletion target: add a marker or remove a particular version
Scope and conditionsBucket-level states; existing null versions; no return to unversioned state; full versions and Lifecycle
Used in this lessonSuspending does not return the bucket to its unversioned state
Scope and conditionsWrites replace the null version while prior non-null versions remain
Used in this lessonSuspending does not return the bucket to its unversioned state
Scope and conditionsNull-version removal plus null marker; API reference used for permission spelling
Used in this lessonSuspending does not return the bucket to its unversioned state