Amazon Simple Storage Service
Developer Guide (API Version 2006-03-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Working With Delete Markers

A delete marker is a placeholder (marker) for a versioned object that was named in a simple DELETE request. Because the object was in a versioning-enabled bucket, the object was not deleted. The delete marker, however, makes Amazon S3 behave as if it had been deleted.

A delete marker is like any other object (it has a key and version ID) except that it:

  • Does not have data associated with it

  • Is not associated with an access control list (ACL) value

  • Does not retrieve anything from a GET request because it has no data; you get a 404 error

  • The only operation you can use on a delete marker is DELETE and only the bucket owner can issue such a request

Only Amazon S3 can create a delete marker, and it does so whenever you send a DELETE Object request on an object in a versioning-enabled or suspended bucket. The object named in the DELETE request is not actually deleted, instead the delete marker becomes the latest version of the object. (The object's key becomes the key of the Delete Marker.) If you try to get an object and its latest version is a delete marker, Amazon S3 responds with:

  • A 404 (Object not found) error

  • A response header, x-amz-delete-marker: true

The response header tells you that the object accessed was a delete marker. This response header never returns false; if the value is false, Amazon S3 does not include this response header in the response.

The following figure shows how a simple GET on an object, whose latest version is a delete marker, returns a 404 No Object Found error.

The only way to list delete markers (and other versions of an object) is by using the versions sub-resource in a GET Bucket versions request. A simple GET does not retrieve delete marker objects. The following figure shows that a GET Bucket request does not return objects whose latest version is a delete marker.