Is there a way to restore a folder completely deleted from s3?

0

Someone from my team deleted by accident a whole folder from an s3 bucket (root directory). We have versioning enabled. Is there a way to restore this folder?

Currently, the folder doesn't appear when I enable "show versions".

Regards,

Diego
已提問 1 個月前檢視次數 99 次
6 個答案
1

Hello,

Since versioning was enabled on the S3 bucket, the folder and all its contents should still be retrievable even after deletion. When an object is deleted from a versioned bucket, S3 doesn't permanently remove it but rather inserts a delete marker to indicate it was deleted.

You can try listing the object versions for the bucket to see if you can locate the folder. The

aws s3api list-object-versions

command would show all versions including any delete markers. You may be able to identify the folder by name or last modified time.

If the folder is present but marked as deleted, you can make it current again by removing the delete marker. The

aws s3api delete-object --object <folder-name> --version-id <delete-marker-id>

the command would do this.

For some extra information:

https://repost.aws/knowledge-center/s3-retrieve-deleted-object

profile picture
Julian
已回答 1 個月前
profile picture
專家
已審閱 1 個月前
1

When you empty a bucket that has S3 Versioning enabled or suspended, all versions of all the objects in the bucket are deleted.

https://docs.aws.amazon.com/AmazonS3/latest/userguide/empty-bucket.html

profile picture
Julian
已回答 1 個月前
profile picture
專家
已審閱 1 個月前
1

You can utilize CloudTrail to review logs and determine which user performed the "empty bucket" action. Additionally, if you have Amazon S3 backups configured in your account, you can restore the deleted folder at any time. However, this feature must be enabled beforehand. For more information on setting up S3 backups, please visit the AWS documentation: AWS S3 Backups.

profile picture
專家
已回答 1 個月前
0

Thanks for your answer. It seems that the user that "deleted" this files through selecting it on the web console, and pressing the "empty" Button. I comment this because I don't seem to be able to find those files.

Diego
已回答 1 個月前
0

It may also be possible that the user has permanently deleted the folder that already had a delete marker.

Here is my Console, I have created a sample folder with versioning, and deleted it by adding a delete marker. And I can still see it when I turn on show versions.

S3 Console

Enter image description here

profile picture
Julian
已回答 1 個月前
0

It seems that since the files were deleted through "empty bucket", the files get permanently deleted.

This would be the issue that is causing us not to be able to find the files.

I'm not sure if this is true though.

Diego
已回答 1 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南