IAM凭据错误404 [英] IAM credentials error 404

查看:159
本文介绍了IAM凭据错误404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行在EC2实例美国东部-1,我遇到了麻烦博托使用IAM进行身份验证。该AMI是最近亚马逊的Linux。

  $蟒蛇
的Python 2.6.8(未知,2013年3月14日,9时31分22秒)
[GCC 4.6.2 20111027(红帽4.6.2-2)在将linux2
键入help,版权,信贷或许可证的更多信息。
>>>进口博托
>>>博托.__ version__
2.13.3
>>> C = boto.connect_s3()
回溯(最近通话最后一个):
  文件<标准输入>中,1号线,与<模块>
  文件/usr/lib/python2.6/site-packages/boto/__init__.py,第135行,在connect_s3
    返回S3Connection(aws_access_key_id,aws_secret_access_key,** kwargs)
  文件/usr/lib/python2.6/site-packages/boto/s3/connection.py,线路174,在__init__
    validate_certs = validate_certs)
  文件/usr/lib/python2.6/site-packages/boto/connection.py,线路557,在__init__
    主机,配置,self.provider,self._required_auth_capability())
  文件/usr/lib/python2.6/site-packages/boto/auth.py,线路728,在get_auth_handler
    请检查您的凭证%(LEN(名称),STR(地名)))
boto.exception.NoAuthHandlerFound:没有处理程序已经准备好进行身份验证。 1处理程序进行了检查。 ['HmacAuthV1Handler']检查您的凭据
 

由于 https://github.com/boto/boto/pull/1175我能得到多一点的信息。显然,它试图使用IAM,但失败了。

 >>>进口OS
>>> boto.set_stream_logger('博托)
>>> C = boto.connect_s3()
2013年9月26日21:52:11685博托[调试]:检索凭据元数据服务器。
2013年9月26日21:52:11,688博托[错误]:捕获的异常读取实例数据
回溯(最近通话最后一个):
  文件/usr/lib/python2.6/site-packages/boto/utils.py,线路211,在retry_url
    R = opener.open(REQ)
  文件/usr/lib64/python2.6/urllib2.py,线路397,在开
    响应=甲基(REQ,响应)
  文件/usr/lib64/python2.6/urllib2.py,线路510,在HTTP_RESPONSE
    HTTP,请求,响应,code,味精,HDRS)
  文件/usr/lib64/python2.6/urllib2.py,线路435,在错误
    返回self._call_chain(*参数)
  文件/usr/lib64/python2.6/urllib2.py,线路369,在_call_chain
    结果= FUNC(*参数)
  文件/usr/lib64/python2.6/urllib2.py,线路518,在http_error_default
    引发HTTPError(req.get_full_url(),code,味精,HDRS,FP)
HTTPError这样的:HTTP错误404:未找到
2013年9月26日21:52:11725博托[错误]:无法读取实例数据,放弃
 

一个快速tcpdump的同意:博托连接到实例data.ec2.internal GET /最新/元数据/ IAM /安全 - 凭据/ ,然后接收 404未找​​到。这似乎是在第一和唯一的HTTP请求。到目前为止,我一直没能找到一个类似问题的任何报告,但也许博托应在该年底 GET 请求路径提供一个角色名?

任何人都看到我在做什么错了?我怎么可能调试这个问题?

解决方案

  boto.exception.NoAuthHandlerFound:[...]请检查您的凭据
 

当你正在使用IAM,你必须确保你有足够的权限,S3,即通过将你的用户的策略 Amazon S3的完全访问

Running on an ec2 instance in us-east-1, I'm having trouble getting boto to use IAM for authentication. The AMI is a recent 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

Thanks to https://github.com/boto/boto/pull/1175 I was able to get a little more information. Apparently it's trying to use IAM, but failing.

>>> 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

A quick tcpdump agrees: boto connects to instance-data.ec2.internal with GET /latest/meta-data/iam/security-credentials/ and then receives 404 Not Found. That seems to be the first and only HTTP request. So far I haven't been able to find any reports of a similar issue, but maybe boto should supply a role name at the end of that GET request path?

Anyone see what I'm doing wrong? How might I debug this problem?

解决方案

boto.exception.NoAuthHandlerFound: [...] Check your credentials

As you are using IAM, you have to ensure that you have sufficient permission for S3, i.e. by attaching the policy Amazon S3 Full Access at your user.

这篇关于IAM凭据错误404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆