Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to recover a file I deleted from my S3 bucket?

share|improve this question
up vote 16 down vote accepted

According to the Amazon S3 Documentation:

Once deleted, there is no method to restore or undelete an object.

share|improve this answer
It's unfortunate S3 doesn't support snapshots. – churnd Mar 24 '10 at 11:40

If you have versioning enable, yes you can! On a versioned bucket, a delete action on a file does not really delete it but it adds a version with a "Delete Marker". You can delete the delete marker with the AWS CLI:

aws s3api delete-object --bucket yourbucket-name --key "yourfile" --version-id id_of_the_delete_marker

You can get all the files in the bucket with

aws --output text s3api list-object-versions --bucket yourbucket-name > files.txt

If you want to undelete all the files in the bucket you can try:

echo '#!/bin/bash' > && aws --output text s3api list-object-versions --bucket yourbucket-name | grep -E "^DELETEMARKERS" | awk '{FS = "[\t]+"; print "aws s3api delete-object --bucket yourbucket-name --key \42"$3"\42 --version-id "$5";"}' >> && .; rm -f;
share|improve this answer
I appreciate this answer! Worked flawlessly. – nojak Jan 4 at 22:11
this saved my evening. thank you! – Von Landfried Feb 18 at 4:19
dude! your undelete all files script just saved my life. thank you. – herostwist Mar 16 at 11:39

Just updating this question as I was looking for the answer:

You can add VERSIONING to S3 buckets now. This will cause S3 to keep versions of an object even after deletion. Full documentation:

share|improve this answer
Is it possible to retrieve a deleted file over AWS Console? Can't find a way to do that. – Rafael Oliveira Jan 30 '14 at 22:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.