Skip to content

After soft deletion of the object, should the latest version be updated as the delete marker, or the version of the object put just before deletion?

0

I am trying to soft delete an object having multiple versions. So, after soft delete, the latest version should be updated as the delete marker or the version of the object put just before the deletion? In other words, the tag "isLatest" should be updated with the delete marker or the version of the object put just before the deletion?

asked 2 years ago532 views
3 Answers
4

When you soft delete an object with multiple versions in S3, the latest version is updated as the delete marker. So, the "isLatest" tag is associated with the delete marker, indicating that it's the latest version and represents the deletion of the object. If you delete the delete marker, the version of the object at the time of the soft deletion will be restored.

  • Soft deletion creates a delete marker.
  • The delete marker is marked as the latest version.
  • You cannot set tags on delete markers.

If you need to manage delete markers or retrieve information about them, you can use AWS CLI commands like aws s3api list-object-versions

EXPERT
answered 2 years ago
3

Hello.

When you delete an object in S3 that has versioning enabled, a deletion marker is created as the latest version.
Therefore, the latest version is a deletion marker.
If you delete the deletion marker, the version of the object at the time of soft deletion will be restored.
https://docs.aws.amazon.com/AmazonS3/latest/userguide/DeletingObjectVersions.html

I'm not sure how you're using the "isLatest" tag, but you can't set tags on deletion markers.
https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingDelMarkers.html

EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago
EXPERT
reviewed 2 years ago
2

It should be the delete marker.

Setting it to the version before the delete marker was applied is effectively like rolling back the delete operation.

See the section Use the AWS CLI to remove the delete marker of https://repost.aws/knowledge-center/s3-undelete-configuration

Look at the aws s3api list-object-versions command, an in particular the last bit --query 'DeleteMarkers[?IsLatest==true]'

For an object to be considered to be deleted, IsLatest has to be true for the delete marker.

EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.