Interview Q&A / AWS & Cloud

IntermediateQuick answer1 min readUpdated 3 Oct 2026

What happens when you delete an object in an S3 bucket that has versioning enabled?

SHORT ANSWER

S3 does not remove the data. It adds a delete marker as the newest version, so normal reads return 404, but older versions remain and can be restored by removing the marker or fetching a version ID.

Explain it simply

Versioning is like the history in Google Docs. When you delete the document, it only disappears from your list; the earlier versions still sit in the history. S3 hides the object by placing a "deleted" sticker on top instead of shredding it.

Example

text
Bucket with versioning ON, key: notes.txt

PUT notes.txt   -> version v1
PUT notes.txt   -> version v2   (current)
DELETE notes.txt -> adds delete marker  (current)

GET notes.txt           -> 404 (current version is a marker)
GET notes.txt?versionId=v2 -> returns v2
Delete the marker       -> v2 becomes current again

DELETE notes.txt?versionId=v1 -> v1 permanently removed

Key facts: versioning once enabled can only be suspended, never fully turned off. Every version is stored and billed, so combine versioning with a lifecycle rule that expires old noncurrent versions. Adding MFA Delete requires an MFA code to permanently delete a version.

Versioning protects against accidental deletes and overwrites, and it is a prerequisite for cross-Region replication.

What to say in the interview

"With versioning on, a plain delete just adds a delete marker and older versions stay. Removing the marker restores the object, and deleting a specific version ID is the only permanent delete. I add a lifecycle rule to clean up old noncurrent versions so cost does not grow forever."

Common mistakes

  • Assuming a versioned bucket stops charging for deleted objects.

#aws#s3#versioning

Related questions

Practise more AWS & Cloud questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open AWS & Cloud quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.