[英]An error occurred (AccessDenied) when calling the PutObject operation: Access Denied python
[英]An error occurred (AccessDenied) when calling the ListBuckets operation: Access Denied
我正在一个项目中工作,目标是从亚马逊 S3 中提取报告。 目前我正在尝试访问 S3 位置以检查我的可用存储桶列表。
我在 python 中工作,我已经在提示中设置了我的所有凭据:aws configure。
在我的 python 文件中,当我尝试使用代码列出我所有的存储桶时:
import boto3
s3 = boto3.resource('s3')
for bucket in s3.buckets.all():
print (bucket.name)
我收到此错误:
回溯(最近一次调用):文件“C:\\Users\\bakpovo\\testAmazon.py”,第 3 行,用于 s3.buckets.all() 中的存储桶:文件“C:\\Users\\bakpovo\\AppData\\Local\\ Programs\\Python\\Python38\\lib\\site-packages\\boto3\\resources\\collection.py", line 83, in iter for page in self.pages(): File "C:\\Users\\bakpovo\\AppData\\Local\\Programs\\ Python\\Python38\\lib\\site-packages\\boto3\\resources\\collection.py”,第 161 行,页数 = [getattr(client, self._py_operation_name)(**params)] 文件“C:\\Users\\bakpovo\\ AppData\\Local\\Programs\\Python\\Python38\\lib\\site-packages\\botocore\\client.py”,第 276 行,在 _api_call 中返回 self._make_api_call(operation_name, kwargs) 文件“C:\\Users\\bakpovo\\AppData\\Local\\ Programs\\Python\\Python38\\lib\\site-packages\\botocore\\client.py”,第 586 行,在 _make_api_call 中引发 error_class(parsed_response, operation_name) botocore.exceptions.ClientError:调用 ListBuckets 操作时发生错误(AccessDenied):访问拒绝
有人知道发生了什么吗? 我的凭据不好吗?
谢谢
谢谢大家的回答。 我解决了我的问题。 我刚刚将我的 s3 位置添加到我的 shell 语法中,如下所示:
aws s3 ls s3://aps-external-xxxx/aps-downloadxxx-xxx-e306fd2/
这是工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.