Shahzaib Sheikh
Shahzaib Sheikh

Reputation: 667

AWS S3 Object delete from console deletes versions too

I have recently enabled object versioning on our AWS S3 Bucket. My understanding was that if I enable versioning on a bucket the object will not be deleted but a delete marker will be created with some VersionId. The idea is to not loose any data whatsoever. When tried deleting from console after enabling versioning on Bucket the object and all its versions were deleted. But when using AWS SDK for NodeJS deleteObject method it returned me DeleteMarker and VersionId and I was able to restore the object. Can we get the same behaviour from console?

Upvotes: 0

Views: 716

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 270154

Do not worry -- the previous versions were not deleted.

When viewing a Versioned bucket using the Amazon S3 management console, there is a Versions control that allows you to select Hide or Show.

When deleting an object in the default view, the object will appear to have been deleted. However, if you select Versions: Show, then the previous version(s) and the Delete Marker will appear.

This is because the default view only shows the 'latest version' of the object. If an object is deleted in this view, a Delete Marker is added as the latest version, which makes it look like the object is gone. Changing to Versions: Show will reveal the Delete Marker and the prior version(s).

Upvotes: 3

Related Questions