How do I restore deleted files in S3?

0

I mistakenly deleted files from my 'version enabled' S3 bucket. I went thru the steps offered by 'Support':

  1. Open the Amazon S3 console.
  2. From the list of buckets, open the bucket of the deleted object.
  3. Navigate to the folder of the deleted object.
  4. Turn on List versions.
  5. In the search bar, enter the name of the deleted object.
  6. Select the previous version of the object (the actual object rather than the delete marker). Choose Actions, and then choose Download. However, it just shows "0 matches". I am the owner of the bucket, but don't know if 'have permissions to s3:GetObjectVersion' - or how to get those 'permissions'.
asked 2 years ago22098 views
3 Answers
1

I tried experimenting a bit and here are a few possibilities I could think of

  1. You might have enabled versioning after the file was uploaded in which case the objects before the versioning was enabled would not have versions. So if you have deleted the object then there is no version to retrieve

Assuming the versioning was enabled before the object was uploaded
2. Did you provide the exact object name? Remember the object name is case sensitive and so you must provide the exact object name
3. Is the bucket too big to manually find it instead of search? There could be two listings. One with the delete marker and then another, the actual version of the object. If you delete the one with delete marker again, then you will see the object in search
4. You might have deleted the object first. Then if you list down the objects, it will show two objects with the same name. One is the version and the other with delete marker. If you delete these two again then you cannot recover the object
5. Go to bucket permissions and check if 'ACLs are disabled. All objects in this bucket are owned by this account' appears. If it does then you have the permissions

answered 2 years ago
  • I believe the enable versioning was enabled before objects were uploaded; I used the exact object name to search with; bucket's not too big; only deleted them once; I as owner are the only one authorized with full permissions. Thanks for going through these.

0

AWS introduced Versioning-enabled buckets a while ago to help you recover objects from accidental deletion or overwrite. Prior to this feature being introduced there was no way to recover a deleted file.

NOTE: By default, S3 Versioning is disabled on buckets, and you must explicitly enable it to protect files from accidental deletes or updates

AWS
answered 2 years ago
  • As stated, I deleted files "from my 'version enabled' S3 bucket." Therefore, should I not be able to restore them?

0

If your goal was to restore object into bucket, you don't need to download (and reupload it) but you could simply remove the delete marker as instructed in https://repost.aws/knowledge-center/s3-undelete-configuration

profile picture
EXPERT
Kallu
answered 2 months 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.

Guidelines for Answering Questions