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
preguntada hace un mes100 visualizaciones
6 Respuestas
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
respondido hace un mes
profile picture
EXPERTO
revisado hace un mes
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
respondido hace un mes
profile picture
EXPERTO
revisado hace un mes
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
EXPERTO
respondido hace un mes
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
respondido hace un mes
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
respondido hace un mes
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
respondido hace un mes

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas