schacon / fuzec2

fuzed ec2 helper script

This URL has Read+Write access

fuzec2 / README
d25d4ca1 » schacon 2008-06-05 added README 1 FuzEc2 is a dumb helper script to automate all the stuff I was doing
2 manually for testing stacks of EC2 instances running a webapp on Fuzed.
3
4 Usage is thus:
5
6 $ cp fuze.example fuze
7 $ vim fuze (change all the configs)
8 $ ./fuze
9
10 This will list the things you can do with the script
11
12 $ ./fuze spin
13
14 This will show you all the instance types you can spin, eg:
15
16 available types:
17 INST TYPE RAM(GB) CU DISK ARCH COST/H
18 m1.small 1.7 1 160 32 0.1
19 m1.large 7.5 4 850 64 0.4
20 m1.xlarge 15.0 8 1690 64 0.8
21 c1.medium 1.7 5 350 32 0.2
22 c1.xlarge 7.0 20 1690 64 0.8
23
24 Then you can start spinning instances via:
25
26 $ ./fuze spin m1.small
27
28 To see which instances you have running, type:
29
30 $ ./fuze list
31
32 i-213ff448 domU-12-31-39-00-C0-02 ec2-75-101-131-181.compute-1.amazonaws.com m1.small running
33 i-1839f271 domU-12-31-39-00-5D-C6 ec2-67-202-36-240.compute-1.amazonaws.com m1.small running
34 i-a633f8cf domU-12-31-39-00-5D-87 ec2-75-101-225-2.compute-1.amazonaws.com m1.small running
35 i-b839f2d1 domU-12-31-39-00-E8-C3 ec2-75-101-131-128.compute-1.amazonaws.com m1.small running
36 i-5732f93e domU-12-31-39-00-8D-91 ec2-75-101-205-249.compute-1.amazonaws.com c1.xlarge running
37 i-0b33f862 domU-12-31-39-00-8D-71 ec2-75-101-200-57.compute-1.amazonaws.com c1.xlarge running
38 i-c833f8a1 domU-12-31-39-00-95-11 ec2-75-101-213-58.compute-1.amazonaws.com c1.xlarge running
39 i-163cf77f domU-12-31-39-00-22-21 ec2-67-202-40-157.compute-1.amazonaws.com m1.xlarge running
40 i-3b3df652 domU-12-31-39-00-C0-B7 ec2-75-101-254-200.compute-1.amazonaws.com m1.small running
41
42 To make those instances into certain Fuzed node types, do thusly:
43
44 $ ./fuze attach_master i-b839f2d1 # creates a master node - do this first
45 $ ./fuze attach_faceplate i-1839f271 # creates a faceplate
46 $ ./fuze attach_frontend i-213ff448 # creates an haproxy node - do this after you add faceplates
47 $ ./fuze attach_rails i-5732f93e # creates a rails node
48
49 Then you'll probably want to assign your frontend a static IP:
50 $ ec2-allocate-address # to get a static IP if you don't have one
51 $ ec2-associate-address YOUR.NEW.IP.ADDY -i i-213ff448 # assign your static IP to your haproxy node
52
53 To add more rails backend nodes, just do:
54
55 $ ./fuze spin c1.xlarge # wait a minute for it to spin
56 $ ./fuze list # grab the new i-xxxxxx instance id
57 $ ./fuze attach_rails i-xxxxxx
58
59 That's it - your capacity goes up. For faceplates, you do this:
60
61 $ ./fuze spin m1.small # wait a minute for it to spin
62 $ ./fuze list # grab the new i-xxxxxx instance id
63 $ ./fuze attach_faceplate i-xxxxxx
64 $ ./fuze attach_frontend i-213ff448 # re-run this to make haproxy rewrite and restart
65
66 You can see the stats on your haproxy node by visiting here:
67
68 http://your-frontend-address/haproxy?stats
69
70 And then enter the username/password you put in your config file to get access.
71
72
73 Here is an example of one big-ass cluster:
74
75 $ ./fuze list
76
77 frontend i-213ff448 domU-12-31-39-00-C0-02 ec2-75-101-131-181.compute-1.amazonaws.com m1.small running
78 faceplate i-1839f271 domU-12-31-39-00-5D-C6 ec2-67-202-36-240.compute-1.amazonaws.com m1.small running
79 faceplate i-a633f8cf domU-12-31-39-00-5D-87 ec2-75-101-225-2.compute-1.amazonaws.com m1.small running
80 faceplate i-4a33f823 domU-12-31-39-00-5D-D4 ec2-67-202-52-242.compute-1.amazonaws.com m1.small running
81 master i-b839f2d1 domU-12-31-39-00-E8-C3 ec2-75-101-131-128.compute-1.amazonaws.com m1.small running
82 rails i-5732f93e domU-12-31-39-00-8D-91 ec2-75-101-205-249.compute-1.amazonaws.com c1.xlarge running
83 rails i-0b33f862 domU-12-31-39-00-8D-71 ec2-75-101-200-57.compute-1.amazonaws.com c1.xlarge running
84 rails i-c833f8a1 domU-12-31-39-00-95-11 ec2-75-101-213-58.compute-1.amazonaws.com c1.xlarge running
85 rails i-4f33f826 domU-12-31-39-00-90-21 ec2-75-101-199-42.compute-1.amazonaws.com c1.xlarge running
86 rails i-0933f860 domU-12-31-39-00-8D-B1 ec2-75-101-206-32.compute-1.amazonaws.com c1.xlarge running
87 rails i-cd33f8a4 domU-12-31-39-00-91-61 ec2-75-101-205-227.compute-1.amazonaws.com c1.xlarge running
88 rails i-3633f85f domU-12-31-39-00-8C-71 ec2-75-101-195-69.compute-1.amazonaws.com c1.xlarge running
89 rails i-163cf77f domU-12-31-39-00-22-21 ec2-67-202-40-157.compute-1.amazonaws.com m1.xlarge running
90 rails i-3b3df652 domU-12-31-39-00-C0-B7 ec2-75-101-254-200.compute-1.amazonaws.com m1.small running
91
92 Watch out, though - that particular cluster costs about $6.40/hour to run
93 - thats $150 a day, so don't forget about it. It's unlikely you'll need it,
94 even with really crappy Rails apps, that should process a freak-load of requests
95 per second, it represents about 350 Rails handlers and something like 60 cores.