我正在尝试按照boto3 文档列出存储桶。
import boto3
s3 = boto3.client(service_name = 's3',
region_name = 'us-east-2',
aws_access_key_id='xxxxxx',
aws_secret_access_key= 'xxxxx'
)
response = s3.list_buckets()
# Output the bucket names
print('Existing buckets:')
for bucket in response['Buckets']:
print(f' {bucket["Name"]}')
但事实证明有一个错误,它说
ClientError: An error occurred (AccessDenied) when calling the ListBuckets operation: Access Denied
我为这个错误找到了一些类似的帖子,但我仍然不知道如何解决我的错误。任何帮助,将不胜感激。