Bees with machine gun using Amazon free tier

社会主义新天地 提交于 2019-12-06 14:53:09

问题


I've been trying to use bees with machine gun without success.

As far as I understand, this is just a fabric script that uses AWS to create EC2 instances (bees) in order to perform distributed load tests to a target (website).

These are the steps I took:

. Went to AWS IAM and created a new user and assigned to a group that has admin permissions:

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

. The creation of this user gave me an aws_access_key_id and and an aws_secret_access_key. . I used these credentials to create a .boto file where I put this:

[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

. I place this .boto file in my (local) home directory.

. I also created a security group called "public" and enabled ssh access:

SSH  TCP  22   0.0.0.0/0 

. I put the .pem key I use to connect to the server within my local .ssh/ folder. I also chmod it to 0660:

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

. I installed bees with machine gun LOCALLY. Everything seems ok, but when I run:

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

it outputs:

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

Then, my first question is:

Does AWS let me create EC2 instances on demand using the FREE TIER?

Besides AWS Free tier abilities. Is there something I am missing? I've been troubleshooting this by following every web tutorial I found. No luck.

Does anybody know what is the problem?

Thanks! Leandro


回答1:


The problem is, I think, this line in your boto config file:

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

This is telling boto that it should try to use this hostname to make EC2 requests but this appears to be the hostname of an EC2 instance which will not be able to reply to these requests.

Just remove this line and let boto use the pre-configured host name for the EC2 service and you should be ok.



来源:https://stackoverflow.com/questions/27040859/bees-with-machine-gun-using-amazon-free-tier

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!