-1

所以我正在尝试使用带有机枪的蜜蜂来加载测试我自己的网站。

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

1 回答 1

2

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

  • 您可以在调用 connect_to_region 时显式传递aws_access_key_id它们aws_secret_access_key
  • 您可以设置环境变量AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY
  • 您可以创建一个 boto 配置文件(有关详细信息,请参阅文件)并将该文件放入其中/etc/config,或者~/.boto您可以将其放在您想要的任何位置并将环境变量设置BOTO_CONFIG为指向它。
  • 如果您使用IAM 角色,boto 将在 EC2 服务器上的实例元数据中找到凭证。
于 2012-12-07T11:53:18.897 回答