我读过这个问题,我有一个类似的问题,但是通过打印调试信息,我得到了一些不同的东西,我不确定我在这里缺少什么:
当我运行以下代码时,我总是会收到此错误。
s3 = boto3.resource('s3')
bucket_name = "python-sdk-sample"
print("Creating new bucket with name:", bucket_name)
s3.create_bucket(Bucket=bucket_name)
我已将我的凭据文件保存在
C:\Users\myname\.aws\credentials
, Boto 应该从那里读取我的凭据。
我的设置错了吗?
这是来自 的输出boto3.set_stream_logger('botocore', level='DEBUG')
。
2020-11-21 18:18:39,686 botocore.credentials [DEBUG] Looking for credentials via: env
2020-11-21 18:18:39,686 botocore.credentials [DEBUG] Looking for credentials via: assume-role
2020-11-21 18:18:39,686 botocore.credentials [DEBUG] Looking for credentials via: assume-role-with-web-identity
2020-11-21 18:18:39,686 botocore.credentials [DEBUG] Looking for credentials via: sso
2020-11-21 18:18:39,686 botocore.credentials [DEBUG] Looking for credentials via: shared-credentials-file
2020-11-21 18:18:39,686 botocore.credentials [DEBUG] Looking for credentials via: custom-process
2020-11-21 18:18:39,686 botocore.credentials [DEBUG] Looking for credentials via: config-file
2020-11-21 18:18:39,687 botocore.credentials [DEBUG] Looking for credentials via: ec2-credentials-file
2020-11-21 18:18:39,687 botocore.credentials [DEBUG] Looking for credentials via: boto-config
2020-11-21 18:18:39,687 botocore.credentials [DEBUG] Looking for credentials via: container-role
2020-11-21 18:18:39,687 botocore.credentials [DEBUG] Looking for credentials via: iam-role
2020-11-21 18:18:39,693 botocore.utils [DEBUG] Caught retryable HTTP exception while making metadata service request to http://xxx.xxx.xxx.xxx/latest/api/token: Could not connect to the endpoint URL: "http://xxx.xxx.xxx.xxx/latest/api/token"