l3_*_*_08 4 python amazon-s3 amazon-web-services python-3.x boto3
我是 Boto3 和 AWS API 的新手,我想获取存储桶名称列表以及 S3 中可用存储桶的数量。
任何帮助表示赞赏。
要获取您帐户中的所有存储桶:
import boto3
s3 = boto3.resource('s3')
bucket_list = [bucket.name for bucket in s3.buckets.all()]
print len(bucket_list)
print bucket_list
Run Code Online (Sandbox Code Playgroud)