Unable to list bucket, appears to time out

0

Hi, I have a bucket shareablee-next that I'm not able to list the contents of. In the web console, the ListObjects request appears to time out, and on the CLI the command runs for a long time without returning anything.

質問済み 4年前404ビュー
1回答
0

It looks like this was due to having versioning enabled on this bucket, and having lots of deleted objects retained as previous versions.

If I did something like this:

import boto3
s3 = boto3.resource("s3")
bucket = s3.Bucket("shareablee-next")
for obj in bucket.object_versions.filter(Prefix='testing/'):
    print(obj.key)

I was able to quickly list object versions. It appears that the normal object list operation was slow because it had to filter out many, many, deleted objects first.

My ultimate goal was to delete this objects along with their previous versions, so I can also just use this:

import boto3
s3 = boto3.resource("s3")
bucket = s3.Bucket("shareablee-next")
bucket.object_versions.filter(Prefix='testing/').delete()

I had also set up a lifecycle rule, but it also seemed to be delayed by the slow listing. Now that I've run this delete script for a while, I can list the bucket again, and there are still objects that should have been deleted by now.

回答済み 4年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ