将Boto与IAM角色一起使用时出错

时间:2014-07-03 01:15:41

标签: python amazon-web-services boto amazon-iam

我正在尝试使用beeswithmachineguns来加载测试我们在AWS中托管的一些网站。我试图从具有IAM角色的机器启动它,并且它需要能够执行此操作所需的所有权限。但是,当我尝试时,我收到以下错误:

/usr/lib64/python2.6/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
  _warn("Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
Connecting to the hive.
Traceback (most recent call last):
  File "/usr/bin/bees", line 5, in <module>
    main.main()
  File "/usr/lib/python2.6/site-packages/beeswithmachineguns/main.py", line 127, in main
    parse_options()
  File "/usr/lib/python2.6/site-packages/beeswithmachineguns/main.py", line 111, in parse_options
    bees.up(options.servers, options.group, options.zone, options.instance, options.login, options.key)
  File "/usr/lib/python2.6/site-packages/beeswithmachineguns/bees.py", line 93, in up
    ec2_connection = boto.connect_ec2()
  File "/usr/lib/python2.6/site-packages/boto/__init__.py", line 135, in connect_ec2
    return EC2Connection(aws_access_key_id, aws_secret_access_key, **kwargs)
  File "/usr/lib/python2.6/site-packages/boto/ec2/connection.py", line 87, in __init__
    https_connection_factory, path)
  File "/usr/lib/python2.6/site-packages/boto/connection.py", line 638, in __init__
    debug, https_connection_factory, path)
  File "/usr/lib/python2.6/site-packages/boto/connection.py", line 281, in __init__
    host, config, self.provider, self._required_auth_capability())
  File "/usr/lib/python2.6/site-packages/boto/auth.py", line 308, in get_auth_handler
    'Check your credentials' % (len(names), str(names)))
boto.exception.NoAuthHandlerFound: No handler was ready to authenticate. 1 handlers were checked. ['QuerySignatureV2AuthHandler'] Check your credentials

为了进一步测试,我创建了以下python脚本:

#!/usr/bin/python26

import boto
version = boto.Version
print version
boto.set_stream_logger('boto')
conn = boto.connect_s3()

还给我错误:

Traceback (most recent call last):
  File "./boto_test.py", line 7, in <module>
    conn = boto.connect_s3()
  File "/usr/lib/python2.6/site-packages/boto/__init__.py", line 107, 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 148, in __init__
    path=path, provider=provider)
  File "/usr/lib/python2.6/site-packages/boto/connection.py", line 281, in __init__
    host, config, self.provider, self._required_auth_capability())
  File "/usr/lib/python2.6/site-packages/boto/auth.py", line 308, 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

我可以通过发出以下命令来确认IAM角色正常工作:

aws ec2 describe-regions --region ap-southeast-2
{
    "Regions": [
        {
            "Endpoint": "ec2.eu-west-1.amazonaws.com", 
            "RegionName": "eu-west-1"
        }, 
        {
            "Endpoint": "ec2.sa-east-1.amazonaws.com", 
            "RegionName": "sa-east-1"
        }, 
        {
            "Endpoint": "ec2.us-east-1.amazonaws.com", 
            "RegionName": "us-east-1"
        }, 
        {
            "Endpoint": "ec2.ap-northeast-1.amazonaws.com", 
            "RegionName": "ap-northeast-1"
        }, 
        {
            "Endpoint": "ec2.us-west-2.amazonaws.com", 
            "RegionName": "us-west-2"
        }, 
        {
            "Endpoint": "ec2.us-west-1.amazonaws.com", 
            "RegionName": "us-west-1"
        }, 
        {
            "Endpoint": "ec2.ap-southeast-1.amazonaws.com", 
            "RegionName": "ap-southeast-1"
        }, 
        {
            "Endpoint": "ec2.ap-southeast-2.amazonaws.com", 
            "RegionName": "ap-southeast-2"
        }
    ]
}

感谢任何帮助:)

干杯

0 个答案:

没有答案