使用boto连接到aws - 凭据错误

时间:2015-04-19 12:07:31

标签: amazon-web-services boto

我尝试使用boto连接到aws,但我遇到了错误。

首先,我创建了一个aws帐户,然后在管理控制台中我点击了IAM并创建了一个新用户。

此用户已关联AWS_ACESS_KEY_ID和AWS_SECRET_ACESS_KEY。

然后我将这个用户凭据存储在/etc/boto.cfg和〜/ .boto中,如下所示:

[Credentials]
aws_acess_key_id = ...
aws_secret_acess_key = ...

现在我试图连接到boto,但我有这个错误:

Traceback (most recent call last):
  File "send.py", line 12, in <module>
    s3 = boto.connect_s3()
  File "/usr/local/lib/python2.7/dist-packages/boto-2.36.0-py2.7.egg/boto/__init__.py", line 141, in connect_s3
    return S3Connection(aws_access_key_id, aws_secret_access_key, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/boto-2.36.0-py2.7.egg/boto/s3/connection.py", line 190, in __init__
    validate_certs=validate_certs, profile_name=profile_name)
  File "/usr/local/lib/python2.7/dist-packages/boto-2.36.0-py2.7.egg/boto/connection.py", line 569, in __init__
    host, config, self.provider, self._required_auth_capability())
  File "/usr/local/lib/python2.7/dist-packages/boto-2.36.0-py2.7.egg/boto/auth.py", line 985, in get_auth_handler
    'Check your credentials' % (len(names), str(names)))
boto.exception.NoAuthHandlerFound: No handler was ready to authenticate. 1 handlers were checked. ['HmacAuthV1Handler'] Check your credentials

boto [DEBUG]:Retrieving credentials from metadata server.
[ERROR]:Caught exception reading instance data

你看到这里有什么不妥吗?

1 个答案:

答案 0 :(得分:3)

  

这是因为boto无法找到要使用的凭据。

确保boto.cfg文件正确无误,请检查拼写是否仍然存在问题Troubleshooting Connections Problem