Home > database >  S3 bucket versioning suspended but toggling show versions on still shows deleted files
S3 bucket versioning suspended but toggling show versions on still shows deleted files

Time:12-08

I created an S3 bucket with versioning enabled and later realized that I don't need to keep multiple versions. I suspended versioning but when I delete a file, and click on show versions, it is showing Delete marker under "Type" and Version ID: null and Size 0 Bytes.

So I don't understand what's the point of suspending the versioning.

CodePudding user response:

From Deleting objects from versioning-suspended buckets - Amazon Simple Storage Service:

You can delete objects from versioning-suspended buckets to remove an object with a null version ID.

If versioning is suspended for a bucket, a DELETE request:

  • Can only remove an object whose version ID is null.
  • Doesn't remove anything if there isn't a null version of the object in the bucket.
  • Inserts a delete marker into the bucket.

I suspect this is because deleting an object does not automatically delete all of the prior versions. Instead, it only deletes the "current" object. However, if the "current object" is a version (that is, there are previous versions of the object), it will still use a Delete Marker to simply hide the current version.

If you wish to delete the whole object (including previous versions), you will need to turn on "Show versions" and delete all of the previous versions.

CodePudding user response:

Response from John is correct. Another option would be to enable a lifecycle rule on the bucket that deletes versions.

  • Related