使用带有.pem的beeswithmachineguns时的boto异常

时间:2012-12-07 09:07:39

标签: python amazon-ec2 boto

所以我试图用蜜蜂用机枪加载测试我自己的网站。

01:01:11 Peters-MacBook-Pro:.ssh peterconerly$ bees up -k amazonkeypair -s 1 -g public -l ec2-user
Connecting to the hive.
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/bin/bees", line 5, in <module>
    main.main()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/beeswithmachineguns/main.py", line 127, in main
    parse_options()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/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 "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/beeswithmachineguns/bees.py", line 93, in up
    ec2_connection = boto.connect_ec2()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/boto/__init__.py", line 135, in connect_ec2
    return EC2Connection(aws_access_key_id, aws_secret_access_key, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/boto/ec2/connection.py", line 87, in __init__
    https_connection_factory, path)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/boto/connection.py", line 638, in __init__
    debug, https_connection_factory, path)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/boto/connection.py", line 281, in __init__
    host, config, self.provider, self._required_auth_capability())
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/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

我按照http://www.synctus.com/blog/2010/04/securing-access-to-amazon-ec2-with-fingerprint-verification直接用boto尝试了 :

>>> import boto.ec2
>>> conn = boto.ec2.connect_to_region('eu-west-1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/boto/ec2/__init__.py", line 53, in connect_to_region
    for region in regions(**kw_params):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/boto/ec2/__init__.py", line 38, in regions
    c = EC2Connection(**kw_params)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/boto/ec2/connection.py", line 87, in __init__
    https_connection_factory, path)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/boto/connection.py", line 638, in __init__
    debug, https_connection_factory, path)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/boto/connection.py", line 281, in __init__
    host, config, self.provider, self._required_auth_capability())
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/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
>>> 

1 个答案:

答案 0 :(得分:2)

如错误消息所示,boto无法找到要使用的任何凭据。它看起来在以下地方:

  • 您可以在调用connect_to_region
  • 时以aws_access_key_idaws_secret_access_key显式传递它们
  • 您可以设置环境变量AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY
  • 您可以创建一个boto配置文件(有关详细信息,请参阅this)并将该文件放在/etc/config~/.boto中,或者您可以将其放在任意位置并设置环境变量BOTO_CONFIG指向它。
  • 如果您使用IAM Roles,boto将在EC2服务器上的实例元数据中找到凭据。