http://wiki3.caucho.com/index.php?title=Using_Botto_To_Run_and_Manage_Amazon_AMI_Instances&feed=atom&action=historyUsing Botto To Run and Manage Amazon AMI Instances - Revision history2024-03-28T13:07:38ZRevision history for this page on the wikiMediaWiki 1.18.0http://wiki3.caucho.com/index.php?title=Using_Botto_To_Run_and_Manage_Amazon_AMI_Instances&diff=4281&oldid=prevRickhigh at 09:40, 3 December 20112011-12-03T09:40:59Z<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr valign='top'>
<td colspan='2' style="background-color: white; color:black;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 09:40, 3 December 2011</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 26:</td>
<td colspan="2" class="diff-lineno">Line 26:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     print "Checking servers..."</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     print "Checking servers..."</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     for instance in instances:</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>     for instance in instances:</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">        done=0</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         instance.update()</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         instance.update()</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         print "Server status %s " % instance.state</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>         print "Server status %s " % instance.state</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 38:</td>
<td colspan="2" class="diff-lineno">Line 39:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div></code></div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div></code></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>TODO read ~/.eucarc file for variables for AWS_ACCESS_KEY, AWS_SECRET_KEY</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline"> # </ins>TODO read ~/.eucarc file for variables for AWS_ACCESS_KEY, AWS_SECRET_KEY</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>TODO Allow passing of ami-bb16ddd2 as command line.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline"> # </ins>TODO Allow passing of ami-bb16ddd2 as command line.</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>TODO read USER_DATA from file passed as command line arg</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline"> # </ins>TODO read USER_DATA from file passed as command line arg</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="background: #ffa; color:black; font-size: smaller;"><div>TODO pass number of servers as command line arg</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins class="diffchange diffchange-inline"> # </ins>TODO pass number of servers as command line arg</div></td></tr>
</table>Rickhighhttp://wiki3.caucho.com/index.php?title=Using_Botto_To_Run_and_Manage_Amazon_AMI_Instances&diff=4280&oldid=prevRickhigh: New page: Using boto to fire up three Resin AMI instances. ami-bb16ddd2 is an AMI which has Resin 4.24 on it. <code> <pre> from boto.ec2.connection import EC2Connection import time conn = EC2Conn...2011-12-03T09:38:02Z<p>New page: Using boto to fire up three Resin AMI instances. ami-bb16ddd2 is an AMI which has Resin 4.24 on it. <code> <pre> from boto.ec2.connection import EC2Connection import time conn = EC2Conn...</p>
<p><b>New page</b></p><div>Using boto to fire up three Resin AMI instances.<br />
<br />
ami-bb16ddd2 is an AMI which has Resin 4.24 on it.<br />
<br />
<code><br />
<pre><br />
from boto.ec2.connection import EC2Connection<br />
import time<br />
<br />
conn = EC2Connection('AWS_ACCESS_KEY', 'AWS_SECRET_KEY')<br />
<br />
resin_image = conn.get_all_images(image_ids=["ami-bb16ddd2"])[0]<br />
reservation = resin_image.run( min_count=3, max_count=3,<br />
user_data="blah blah blah", <br />
instance_type='t1.micro',<br />
key_name="resin2")<br />
<br />
instances = reservation.instances<br />
time.sleep(20)<br />
<br />
count = 0<br />
done = 0<br />
while True:<br />
count += 1<br />
if count > 10: break<br />
print "Checking servers..."<br />
for instance in instances:<br />
instance.update()<br />
print "Server status %s " % instance.state<br />
if instance.state==u'running': done+=1<br />
<br />
if done >= 3: break<br />
time.sleep(20)<br />
<br />
print ("All instances are running")<br />
<br />
</pre><br />
</code><br />
<br />
TODO read ~/.eucarc file for variables for AWS_ACCESS_KEY, AWS_SECRET_KEY<br />
TODO Allow passing of ami-bb16ddd2 as command line.<br />
TODO read USER_DATA from file passed as command line arg<br />
TODO pass number of servers as command line arg</div>Rickhigh