蜜蜂用机枪使用亚马逊免费套餐

时间:2014-11-20 13:30:10

标签: amazon-web-services amazon-ec2 load-testing boto fabric

我一直试图使用bees with machine gun但没有成功。

据我了解,这只是一个结构脚本,它使用AWS创建EC2实例(蜜蜂),以便对目标(网站)执行分布式负载测试。

这是我采取的步骤:

。去了AWS IAM并创建了一个新用户并分配给具有管理员权限的组:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "*",
      "Resource": "*"
    }
  ]
}

。这个用户的创建给了我一个aws_access_key_id和一个aws_secret_access_key。 。我使用这些凭据创建一个.boto文件,我把它放在:

[Credentials]
aws_access_key_id=#####
aws_secret_access_key=###
[Boto]
ec2_region_name = us-west-2b
ec2_region_endpoint = ec2-54-148-72-140.us-west-2.compute.amazonaws.com

。我把这个.boto文件放在我的(本地)主目录中。

。我还创建了一个名为" public"并启用了ssh访问:

SSH  TCP  22   0.0.0.0/0 

。我把.pem密钥用于连接到本地.ssh /文件夹中的服务器。我也把它调到0660:

-rw-------@  1 development  staff   1.7K Nov 19 15:11 key.pem

。我安装了机枪 LOCALLY 的蜜蜂。一切似乎都没问题,但是当我跑步时:

bees up -s 2 -k key -i ami-XXXXXX -g public -z us-west-2b -l ubuntu

输出:

connecting to the hive.
Attempting to call up 2 bees.

Traceback (most recent call last):
  File "/usr/local/bin/bees", line 5, in <module>
    main.main()
  File "/Library/Python/2.7/site-packages/beeswithmachineguns/main.py", line 127, in main
    parse_options()
  File "/Library/Python/2.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/Python/2.7/site-packages/beeswithmachineguns/bees.py", line 104, in up
    placement=zone)
  File "/Library/Python/2.7/site-packages/boto/ec2/connection.py", line 974, in run_instances
    verb='POST')
  File "/Library/Python/2.7/site-packages/boto/connection.py", line 1188, in get_object
    response = self.make_request(action, params, path, verb)
  File "/Library/Python/2.7/site-packages/boto/connection.py", line 1112, in make_request
    return self._mexe(http_request)
  File "/Library/Python/2.7/site-packages/boto/connection.py", line 942, in _mexe
    request.body, request.headers)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 973, in request
    self._send_request(method, url, body, headers)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1007, in _send_request
    self.endheaders(body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 969, in endheaders
    self._send_output(message_body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 829, in _send_output
    self.send(msg)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 791, in send
    self.connect()
  File "/Library/Python/2.7/site-packages/boto/https_connection.py", line 119, in connect
    sock = socket.create_connection((self.host, self.port), self.timeout)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 571, in create_connection
    raise err
socket.timeout: timed out

然后,我的第一个问题是:

AWS是否允许我使用免费级别按需创建EC2实例?

除了AWS免费套餐能力。有什么我想念的吗? 我已经按照我发现的每个网络教程对此进行了故障排除。没有运气。

有人知道这是什么问题吗?

谢谢! 莱安德罗

1 个答案:

答案 0 :(得分:2)

我认为问题在于你的boto配置文件中的这一行:

ec2_region_endpoint = ec2-54-148-72-140.us-west-2.compute.amazonaws.com

这告诉boto它应该尝试使用这个主机名来发出EC2请求,但这似乎是EC2实例的主机名,它无法回复这些请求。

只需删除此行,然后让boto使用EC2服务的预配置主机名,您应该没问题。