Can I restore a folder from the root on a s3 bucket

0

Someone from my team has disabled a directory from an s3 bucket (root directory). The item's won't show when I enable show versions.

Aditionally, when I run the command below, I don't aws s3api list-object-versions --bucket <BUCKET_NAME> --prefix <DIRECTORY_NAME> --output json --query 'DeleteMarkers[?IsLatest=="true"] && ?LastModified>="2024-04-11T00:00:00"'

Diego
질문됨 한 달 전291회 조회
1개 답변
2

If versioning is enabled on your S3 bucket, each object (including those within directories) has a version history. Deleting an object or directory in S3 generally creates a delete marker, which is a placeholder that indicates the object has been deleted. When you enable versioning, you can still access the older versions of the object unless they have been permanently deleted.

Try to check for DeleteMarkers, use the following AWS CLI command::

aws s3api list-object-versions --bucket BUCKET_NAME --prefix DIRECTORY_NAME --output json --query "DeleteMarkers[?IsLatest==\`true\`]"

If you find delete markers for your directory or its contents, you can restore them by deleting the delete markers. This can make the previous version of the directory or objects visible again.

If versioning was not enabled before the directory was deleted, it might be impossible to recover the directory through S3 alone as there would be no stored versions to revert to.

profile picture
전문가
답변함 한 달 전
profile picture
전문가
검토됨 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠