小编tah*_*qui的帖子

How to get more than 1000 objects from S3 by using list_objects_v2?

I have more than 500,000 objects on s3. I am trying get the size of each object. I am using the following python code for that

import boto3

bucket = 'bucket'
prefix = 'prefix'

contents = boto3.client('s3').list_objects_v2(Bucket=bucket,  MaxKeys=1000, Prefix=prefix)["Contents"]

for c in contents:
    print(c["Size"])
Run Code Online (Sandbox Code Playgroud)

But it just gave me the size of top 1000 objects. Based on the documentation we can't get more 1000. Is there any way I can get more than that?

python amazon-s3 boto3

4
推荐指数
3
解决办法
3795
查看次数

标签 统计

amazon-s3 ×1

boto3 ×1

python ×1