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

connect to aws using boto - credentials error

我正在尝试使用 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

你知道这里有什么问题吗?

This is because boto cannot find credentials to use.

确保 boto.cfg 文件正确,并检查拼写,仍然有问题按照 Troubleshooting Connections Problem