Why is Amazon S3 still listing objects that I deleted?

Last updated: 2019-12-17

I deleted a few objects from my Amazon Simple Storage Service (Amazon S3) bucket. Why is Amazon S3 still listing the objects that I deleted?

Resolution

Amazon S3 provides eventual consistency for DELETES in all AWS Regions. Additionally, Amazon S3 replicates data across multiple servers. This means that when you delete an object, it can take some time for the deletion to replicate across all the servers. You might see that if you try to read an object immediately after deleting it, then Amazon S3 returns the object. Or, if you try to list objects in a bucket immediately after deleting one of the objects, then Amazon S3 might list the deleted object.

Note: If you delete an object and you want to upload a new object using the same name, then PUT requests made before you upload the new object will eventually get a consistent response.

If you still see an object after you deleted it, you can use one of the following ways to confirm that the object is in the process of deletion:

  • Enable the debug option on the AWS Command Line Interface (AWS CLI). Then, run the head-object command using the AWS CLI. If the response from a head-object command includes a DeleteMarker header, then this means that the object was deleted. If the response doesn't include a DeleteMarker header, then the object wasn't deleted.
  • Use an AWS SDK to send a HeadObject API call. If the x-amz-delete-marker field in the response is true, then the object was deleted. If x-amz-delete-marker is false, then the object wasn't deleted.

Did this article help you?

Anything we could improve?


Need more help?