Infrastructure
S3 Delete Markers: Recover a Versioned Object Safely
Distinguish an S3 delete marker from permanent version deletion, inspect the exact object history, and verify a controlled recovery without broad bucket changes.
In this article
An S3 object can look deleted while an older version still exists. In a versioned bucket, an ordinary delete can create a delete marker that becomes the current version. Recovering the object safely means inspecting its history and choosing the intended version, not issuing a broad command against the bucket.
AWS's delete marker documentation explains this behavior. Keep the distinction between a current delete marker and a permanently removed version clear. If the required bytes were permanently deleted, removing a marker cannot recreate them.
Confirm the bucket and exact key
Start with the account, bucket, region, and full object key. An object key can contain spaces, punctuation, and path-like components. A mistaken character can lead you to a different history. Record the identifier in the recovery ticket without making private customer filenames public.
Check the bucket's versioning state and relevant retention controls. Versioning, lifecycle rules, replication, access permissions, and object retention serve different purposes. Do not assume that enabling versioning today restores versions that were never retained in the past.
Use a read-only inspection first. Find the object's versions and delete markers, including their version IDs and timestamps. Avoid commands that recursively remove markers or copy every older version. The incident may affect one key even if the bucket contains millions of objects.
Read the history as a sequence
Suppose a synthetic object has version A, then version B, then delete marker C. A normal retrieval of the current key can report that it is absent, while an authorized request for version B can still retrieve those bytes. This example illustrates version history, not a guarantee that every deletion is recoverable.
Now suppose version D was uploaded after marker C. Removing C is not necessarily the action that restores the intended business state, because D may already be current. Inspect the entire relevant sequence before deciding which record to remove or copy.
Also check who or what created the marker. A user action, application cleanup job, or lifecycle process may be responsible. Restoring the object without stopping an erroneous cleanup job can produce a short-lived recovery followed by another deletion.
Choose the recovery operation
If the latest record is the unwanted delete marker and the immediately preceding version is the intended current content, deleting that specific marker may expose the preceding version. That is a targeted metadata-history change and needs the correct version ID.
Alternatively, retrieve the intended older version and copy it to create a new current version through the supported workflow. This can make the recovery explicit in the history, but it may also affect metadata, encryption settings, access behavior, or application expectations. Review those consequences before using it.
Do not guess a version ID from a filename or timestamp. Obtain it from the actual history. Have a second reviewer confirm the bucket, key, version ID, and chosen operation for sensitive objects. Keep the original versions intact unless deletion is separately authorized.
Verify bytes and application behavior
Retrieve the restored content through an authorized path and compare it with a known expected digest or approved reference. A successful API response does not prove that the correct version was restored. A document with the right filename can still contain obsolete or unrelated information.
Check metadata the application relies on, such as content type and custom fields. Then test the application's normal access path. A cache, signed URL, CDN, or database reference may continue to behave differently from a direct object retrieval.
For example, the object may be correct while a previously cached missing response remains visible to users. Investigate cache policy separately rather than repeatedly restoring the object. Record the observed content revision and access result in the recovery ticket.
Permissions and auditability
Use the least privilege needed to inspect and recover the specific object. Some permissions allow listing versions but not reading old content, while others allow deletion of a particular version. Do not expand to unrestricted bucket access merely because the first request fails.
Preserve an audit trail of the approved target and action. Avoid including temporary access URLs or credentials in chat logs. If the incident involves suspected unauthorized deletion, retain the relevant event evidence before changing the object history.
If a permission error blocks recovery, escalate to the bucket owner through the normal process. Disabling retention or weakening account security is not an acceptable shortcut. The recovery plan must respect the controls that protect the data.
Prevent another accidental deletion
Review application delete semantics. Does the interface intend a reversible hide, a current-version delete, or permanent removal of a specific version? Use distinct labels and permissions for actions with different consequences. A single ambiguous “Delete” button can conceal a dangerous distinction.
Test cleanup jobs against synthetic keys in a non-production bucket. Include a current delete marker, multiple versions, a restored object, and an object with retention restrictions. Confirm that the job handles each state deliberately and records a useful outcome.
Our backup restore-testing guide covers the broader recovery discipline. For a redacted object-history export, JSON Diff can help review changes between inspections. It does not access S3 or restore objects.
Conclusion
S3 delete-marker recovery works when the needed version still exists and the chosen action matches the history. Resolve the exact key, inspect versions, use a narrowly scoped operation, and verify both the content and the application's access path before calling the recovery complete.