us-east-1 の ec2 インスタンスで実行していますが、boto で認証に IAM を使用するのに問題があります。AMI は最近の Amazon Linux です。
$ python
Python 2.6.8 (unknown, Mar 14 2013, 09:31:22)
[GCC 4.6.2 20111027 (Red Hat 4.6.2-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import boto
>>> boto.__version__
'2.13.3'
>>> c = boto.connect_s3()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/site-packages/boto/__init__.py", line 135, in connect_s3
return S3Connection(aws_access_key_id, aws_secret_access_key, **kwargs)
File "/usr/lib/python2.6/site-packages/boto/s3/connection.py", line 174, in __init__
validate_certs=validate_certs)
File "/usr/lib/python2.6/site-packages/boto/connection.py", line 557, in __init__
host, config, self.provider, self._required_auth_capability())
File "/usr/lib/python2.6/site-packages/boto/auth.py", line 728, 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
https://github.com/boto/boto/pull/1175のおかげで、もう少し情報を得ることができました。どうやら IAM を使用しようとしていますが、失敗しています。
>>> import os
>>> boto.set_stream_logger('boto')
>>> c = boto.connect_s3()
2013-09-26 21:52:11,685 boto [DEBUG]:Retrieving credentials from metadata server.
2013-09-26 21:52:11,688 boto [ERROR]:Caught exception reading instance data
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/boto/utils.py", line 211, in retry_url
r = opener.open(req)
File "/usr/lib64/python2.6/urllib2.py", line 397, in open
response = meth(req, response)
File "/usr/lib64/python2.6/urllib2.py", line 510, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib64/python2.6/urllib2.py", line 435, in error
return self._call_chain(*args)
File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib64/python2.6/urllib2.py", line 518, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 404: Not Found
2013-09-26 21:52:11,725 boto [ERROR]:Unable to read instance data, giving up
簡単な tcpdump は同意します: boto は with に接続しinstance-data.ec2.internal
、GET /latest/meta-data/iam/security-credentials/
次に を受け取り404 Not Found
ます。これが最初で唯一の HTTP リクエストのようです。これまでのところ、同様の問題のレポートを見つけることができませんでしたが、おそらく boto はそのGET
リクエスト パスの最後にロール名を提供する必要がありますか?
誰かが私が間違っていることを見ていますか? この問題をデバッグするにはどうすればよいですか?