[英]No Credentials Error - Using boto3 and aws s3 bucket
I am using python and jupyter notebook to read files from an aws s3 bucket, and I am getting the error 'No Credentials Error:Unable to locate credentials' when running the following code:我正在使用 python 和 jupyter 笔记本从 aws s3 存储桶中读取文件,并且在运行以下代码时出现错误“无凭据错误:无法找到凭据”:
import boto3
s3 = boto3.resource('s3')
bucket = s3.Bucket('my-bucket')
for obj in bucket.objects.all():
key = obj.key
body = obj.get()['Body'].read()
I believe I need to put my access key somewhere, but I am not sure where.我相信我需要将访问密钥放在某个地方,但我不确定在哪里。 Thank you!
谢谢!
If you have AWS CLI installed, just do a simple aws configure
.如果您安装了 AWS CLI,只需执行简单的
aws configure
即可。 Then you will be good to go.那你就对 go 好了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.