S3 version recovery and lifecycle
Recover a deleted report
In a versioning-enabled general purpose bucket, overwriting a key creates a new version instead of replacing all history. A normal delete without a version ID adds a delete marker. The marker hides the key from an ordinary read; older versions can still exist. Imagine a bookstore whose daily sales report is accidentally deleted. First inspect the version list, identify the intended report and restore only that report.
reports/day.csv: v1 -> v2 -> marker m3 (current)GET without version ID -> not foundGET version v2 -> report contentsChoose a recovery method
If m3 is the current marker, removing that exact marker makes v2 current again. Alternatively, copy a selected historical version to the same key to create a fresh current version; this keeps the previous history. Verify the recovered content and checksum, not just the presence of the key. Deleting a data version by ID is normally permanent. A marker is not a backup, and versioning does not protect against every authorized deletion. Use separate recovery copies when the risk requires them. This lesson assumes versioning is enabled, not suspended.
Lifecycle: age, transition and expiration
Lifecycle rules automate storage-class changes and expiration for matching objects, including existing eligible objects. Current-version expiration and noncurrent-version expiration are different actions. Noncurrent age starts when a newer version supersedes the older one. In a versioned bucket, ordinary current expiration can create a marker; noncurrent expiration permanently removes eligible historical data. A rule for expired delete markers can clean up markers that have no remaining data versions. Execution is asynchronous; do not assume immediate removal on the eligibility date. Prefix and tag filters narrow scope; review the affected population before enabling a rule.
reports/ current: transition after 30 days (illustrative policy) noncurrent: expire after 90 noncurrent days incomplete multipart: abort after 7 daysCompare cost before moving data
A lower monthly storage rate can cost more for frequently retrieved or short-lived objects. Since the AWS announcement in July 2026, new rules can transition to Standard-IA or One Zone-IA as early as day zero; the 30-day minimum billed duration still applies. These are separate rules. In the worksheet below, assume 30-day months, no size minimum effects, 100 GB, and hypothetical rates. The IA example includes an early deletion charge and retrieval, but excludes transition requests and tax. Real estimates also need request counts, minimum billable object sizes, restore fees and region-specific rates.
Standard: 100 GB * $0.024 * 10/30 = $0.80IA: 100 GB * $0.012 * 30/30 = $1.20IA retrieval: 20 GB * $0.01 = $0.20IA total (partial estimate) = $1.40Practice safely
Given v1, v2 and current marker m3, explain two recovery options and choose one if v1 rather than v2 is the correct report. Then decide whether a 90-day noncurrent expiration policy satisfies a 120-day recovery requirement. It does not; revise the policy or add verified independent retention. In a real approved lab, list versions and multipart uploads before teardown; remove only identified lab data and markers after authorization, check retention constraints, and verify remaining resources and charges. Do not execute deletes for this offline exercise.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
S3 version recovery and lifecycle — knowledge check
Apply the fictional report storage and governance design.
A versioned key has v1, v2 and current marker m3. What restores v2 as current without copying data?
The correct report is v1, but v2 is newer. Which method preserves history and makes v1 content current?
A report must remain recoverable for 120 days after replacement. What is wrong with 90-day noncurrent expiration?
At hypothetical $0.012/GB-month, 100 GB in IA for 10 days with 30-day minimum costs what for storage?
A new lifecycle rule matches already old objects. Which precaution is appropriate?