Permalink
Browse files

Bees now get a simple 'Name' tag on creation. Closes #20.

  • Loading branch information...
1 parent cca7eb0 commit d5530744fc5f236c21a7d850cb3bcbb5e259f1b2 @onyxfish onyxfish committed Jul 25, 2011
Showing with 8 additions and 2 deletions.
  1. +2 −2 README.textile
  2. +6 −0 beeswithmachineguns/bees.py
View
@@ -50,9 +50,9 @@ bees down
This spins up 4 servers in security group 'public' using the EC2 keypair 'frakkingtoasters', whose private key is expected to reside at ~/.ssh/frakkingtoasters.pem.
-Note: the default EC2 security group is called 'default' and by default it locks out SSH access. I recommend creating a 'public' security group for use with the bees and explicitly opening port 22 on that group.
+*Note*: the default EC2 security group is called 'default' and by default it locks out SSH access. I recommend creating a 'public' security group for use with the bees and explicitly opening port 22 on that group.
-Note 2: Always include a trailing slash when testing a root domain. The underlying load-testing tool (ab) doesn't support raw domains.
+*Note 2*: Always include a trailing slash when testing a root domain. The underlying load-testing tool (ab) doesn't support raw domains.
It then uses those 4 servers to send 10,000 requests, 250 at a time, to attack OurNewWebbyHotness.com.
@@ -105,14 +105,20 @@ def up(count, group, zone, image_id, username, key_name):
print 'Waiting for bees to load their machine guns...'
+ instance_ids = []
+
for instance in reservation.instances:
while instance.state != 'running':
print '.'
time.sleep(5)
instance.update()
+ instance_ids.append(instance.id)
+
print 'Bee %s is ready for the attack.' % instance.id
+ ec2_connection.create_tags(instance_ids, { "Name": "a bee!" })
+
_write_server_list(username, key_name, reservation.instances)
print 'The swarm has assembled %i bees.' % len(reservation.instances)

0 comments on commit d553074

Please sign in to comment.