<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.alestic.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
    <title>Alestic.com</title>
    <link rel="alternate" type="text/html" href="http://alestic.com/" />
    
    <id>tag:alestic.com,2009-04-25://1</id>
    <updated>2010-02-22T09:44:43Z</updated>
    <subtitle>Ubuntu on Amazon EC2</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type Pro 4.25</generator>

<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.alestic.com/alestic" /><feedburner:info uri="alestic" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>alestic</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry>
    <title>SCALE 8x Talk Notes: EC2 Beginners Workshop</title>
    <link rel="alternate" type="text/html" href="http://feeds.alestic.com/~r/alestic/~3/xwYHvTNTZxo/scale-8x-talk-notes-ec2-beginners-workshop" />
    <id>tag:alestic.com,2010://1.84</id>

    <published>2010-02-22T09:24:05Z</published>
    <updated>2010-02-22T09:44:43Z</updated>

    <summary>At SCALE 8x (Southern California Linux Expo, Feb 2010) I did a walkthrough demonstrating how to use the AWS console to run, connect to, and terminate your first Ubuntu server on Amazon EC2. Though they do not include my talking...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="presentations" label="presentations" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="scale" label="SCALE" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="scale8x" label="SCALE8x" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="talks" label="talks" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="workshops" label="workshops" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;At SCALE 8x (Southern California Linux Expo, Feb 2010) I did a walkthrough demonstrating how to use the AWS console to run, connect to, and terminate your first Ubuntu server on Amazon EC2.&lt;/p&gt;

&lt;p&gt;Though they do not include my talking points or the Q&amp;amp;A discussion during and following the session, you can download my slides and workshop handout:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://cdn.anvilon.com/20100220-scale/scale8x-ec2.pdf"&gt;http://cdn.anvilon.com/20100220-scale/scale8x-ec2.pdf&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://cdn.anvilon.com/20100220-scale/scale8x-steps.pdf"&gt;http://cdn.anvilon.com/20100220-scale/scale8x-steps.pdf&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;These slides were not created for use outside of the workshop, so they are not complete in themselves.  I am making them available for the workshop participants who may wish to refer to them to refresh their memory on what was discussed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The instructions talk about removing the private ssh key at the end.  This would not be done in a normal secure environment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This demo used a temporary Ubuntu AMI which had wikimedia installed.  This AMI is not designed for use in production systems as it includes a known wikimedia admin password.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This AMI is subject to being deleted at any time without notice. Did I mention you should not use it in a production system?&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/xwYHvTNTZxo" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2010/02/scale-8x-talk-notes-ec2-beginners-workshop</feedburner:origLink></entry>

<entry>
    <title>The BitSource Interview of Eric Hammond (SCALE, EC2)</title>
    <link rel="alternate" type="text/html" href="http://feeds.alestic.com/~r/alestic/~3/01aj2xzQ9UQ/ec2-scale-interview" />
    <id>tag:alestic.com,2010://1.83</id>

    <published>2010-02-19T01:44:38Z</published>
    <updated>2010-02-19T02:32:02Z</updated>

    <summary>Matthew Sacks, of The BitSource, made the mistake of asking me some questions about Amazon EC2, so I rambled on far too long and the results are posted on the SCALE blog: SCALE: Eric Hammond on Deploying Linux on EC2...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="interviews" label="interviews" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="scale" label="SCALE" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;Matthew Sacks, of &lt;a href="http://www.thebitsource.com/"&gt;The BitSource&lt;/a&gt;, made the mistake of asking me some questions about Amazon EC2, so I rambled on far too long and the results are posted on the SCALE blog:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://www.socallinuxexpo.org/scale8x/blog/eric-hammond-deploying-linux-ec2"&gt;SCALE: Eric Hammond on Deploying Linux on EC2&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In addition to some high level concepts, I point out that Ubuntu is, at the moment, the best choice for a Linux distro on EC2 if you want up-to-date images with modern, consistent kernels.&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/01aj2xzQ9UQ" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2010/02/ec2-scale-interview</feedburner:origLink></entry>

<entry>
    <title>Resizing the Root Disk on a Running EBS Boot EC2 Instance</title>
    <link rel="alternate" type="text/html" href="http://feeds.alestic.com/~r/alestic/~3/MaRe-VZDPE8/ec2-resize-running-ebs-root" />
    <id>tag:alestic.com,2010://1.82</id>

    <published>2010-02-11T03:47:55Z</published>
    <updated>2010-02-11T03:47:29Z</updated>

    <summary>In a previous article I described how to run an EBS boot AMI with a larger root disk size than the default. That’s fine if you know the size you want before running the instance, but what if you have...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="ebs" label="EBS" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ebsboot" label="EBS boot" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="instances" label="instances" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="resize2fs" label="resize2fs" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="snapshots" label="snapshots" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="xfs" label="XFS" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="xfs_growfs" label="xfs_growfs" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;In a previous article I described how to &lt;a href="http://alestic.com/2009/12/ec2-ebs-boot-resize"&gt;run an EBS boot AMI with a larger root disk size than the default&lt;/a&gt;.  That&amp;#8217;s fine if you know the size you want before running the instance, but what if you have an EC2 instance already running and you need to increase the size of its root disk without running a different instance?&lt;/p&gt;

&lt;p&gt;As long as you are ok with a little down time on the EC2 instance (few minutes), it is possible to change out the root EBS volume with a larger copy, without needing to start a new instance.&lt;/p&gt;

&lt;p&gt;Let&amp;#8217;s walk through the steps on a sample Ubuntu 9.10 Karmic EBS boot instance. I tested this with &lt;code&gt;ami-6743ae0e&lt;/code&gt; but check &lt;a href="http://alestic.com/"&gt;Alestic.com&lt;/a&gt; for the latest AMI ids.  &lt;/p&gt;

&lt;p&gt;On the instance we check the initial size of the root file system (15 GB):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              15G  675M   14G   5% /
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The following commands are all run on a system &lt;em&gt;other&lt;/em&gt; than the one we are resizing. Pick a new size (in GB) that is larger than the current size:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;instanceid=&amp;lt;YOURINSTANCEID&amp;gt;
size=20
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Get the root EBS volume id and availability zone for this instance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;oldvolumeid=$(ec2-describe-instances $instanceid |
  egrep "^BLOCKDEVICE./dev/sda1" | cut -f3)
zone=$(ec2-describe-instances $instanceid | egrep ^INSTANCE | cut -f12)
echo "instance $instanceid in $zone with original volume $oldvolumeid"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Stop (not terminate!) the instance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-stop-instances $instanceid
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Detach the original volume from the instance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;while ! ec2-detach-volume $oldvolumeid; do sleep 1; done
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Create a snapshot of the original volume:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;snapshotid=$(ec2-create-snapshot $oldvolumeid | cut -f2)
while ec2-describe-snapshots $snapshotid | grep -q pending; do sleep 1; done
echo "snapshot: $snapshotid"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Create a new volume from the snapshot, specifying a larger size:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;newvolumeid=$(ec2-create-volume \
  --availability-zone $zone     \
  --size $size                  \
  --snapshot $snapshotid |
  cut -f2)
echo "new volume: $newvolumeid"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Attach the new volume to the instance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-attach-volume        \
  --instance $instanceid \
  --device /dev/sda1     \
  $newvolumeid
while ! ec2-describe-volumes $volumeid | grep -q attached; do sleep 1; done
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Start the instance and find its new public IP address/hostname.  (If you were using an elastic IP address, re-assign it to the instance.)&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-start-instances $instanceid
while ! ec2-describe-instances $instanceid | grep -q running; do sleep 1; done
ec2-describe-instances $instanceid
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Connect to the instance with ssh (not shown) and resize the root file system to fill the new EBS volume:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# ext3 root file system (most common)
sudo resize2fs /dev/sda1

# XFS root file system (less common):
sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install -y xfsprogs
sudo xfs_growfs /
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Show that the root file system is the new, larger size (20 GB):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              20G  679M   19G   4% /
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Delete the old EBS volume and snapshot if you no longer need them, though I recommend you at least keep the snapshot for a while just in case:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-delete-volume $oldvolumeid
ec2-delete-snapshot $snapshotid
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note: Since you manually created the new volume and attached it to the instance yourself, it will not be deleted automatically when the instance is terminated.  You can modify the instance attributes to change the &lt;code&gt;delete-on-termination&lt;/code&gt; flag for the volume if you wish.&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/MaRe-VZDPE8" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2010/02/ec2-resize-running-ebs-root</feedburner:origLink></entry>

<entry>
    <title>New Ubuntu 8.04.3 Hardy AMIs for Amazon EC2</title>
    <link rel="alternate" type="text/html" href="http://feeds.alestic.com/~r/alestic/~3/ArXrBSqg9aY/ec2-ubuntu-ami-release-hardy" />
    <id>tag:alestic.com,2010://1.81</id>

    <published>2010-01-30T05:38:11Z</published>
    <updated>2010-01-30T05:45:26Z</updated>

    <summary>Scott Moser (Canonical) built and released new Ubuntu 8.04.3 LTS Hardy images and AMIs for Amazon EC2. I also published new EBS boot AMIs using the same images. I’ve listed all of the AMI ids on http://alestic.com (pick your region...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="ami" label="AMI" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="amis" label="AMIs" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="hardy" label="Hardy" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="image" label="image" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="images" label="images" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="release" label="release" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;Scott Moser (Canonical) built and released new Ubuntu 8.04.3 LTS Hardy images and AMIs for Amazon EC2.  I also published new EBS boot AMIs using the same images.  I&amp;#8217;ve listed all of the AMI ids on &lt;a href="http://alestic.com"&gt;http://alestic.com&lt;/a&gt; (pick your region at the top).&lt;/p&gt;

&lt;p&gt;These AMIs should work better in the us-west-1 region (apt sources.list) and have updated software packages so upgrades on new instances should be faster.&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/ArXrBSqg9aY" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2010/01/ec2-ubuntu-ami-release-hardy</feedburner:origLink></entry>

<entry>
    <title>Southern California Linux Expo - Februrary 19-21, 2010 at the Westin LAX</title>
    <link rel="alternate" type="text/html" href="http://feeds.alestic.com/~r/alestic/~3/S4nOTCJN4y0/scale-ec2-tutorial" />
    <id>tag:alestic.com,2010://1.80</id>

    <published>2010-01-29T01:59:46Z</published>
    <updated>2010-02-22T09:20:42Z</updated>

    <summary> The 8th Southern California Linux Expo (aka SCaLE 8x) is a community organized, non-profit event. Those words and the incredibly cheap price might lead you to believe that it is not worth going to, but if this is your...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="california" label="California" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="conferences" label="conferences" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="events" label="events" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="linux" label="Linux" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="losangeles" label="Los Angeles" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="scale" label="SCaLE" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;&lt;a href="http://www.socallinuxexpo.org/scale8x/"&gt;&lt;img src="http://www.socallinuxexpo.org/scale8x/sites/socallinuxexpo.org.scale8x/files/scale8x_728x90.gif" alt="SCaLE 8x" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.socallinuxexpo.org/"&gt;The 8th Southern California Linux Expo (aka SCaLE 8x)&lt;/a&gt; is a community organized, non-profit event.  Those words and the incredibly cheap price might lead you to believe that it is not worth going to, but if this is your first time you&amp;#8217;ll be amazed by the size, scope, and professionalism of the event with nearly a hundred exhibits and dozens of informative talks.&lt;/p&gt;

&lt;p&gt;Even though you&amp;#8217;re not paying hundreds of dollars for the conference fee, it&amp;#8217;s still worth traveling to if you&amp;#8217;re not in Los Angeles.  If you are in LA, then you have no excuse.&lt;/p&gt;

&lt;p&gt;Just like last year at SCaLE, I will be leading another &amp;#8220;Try-It Lab&amp;#8221; where we&amp;#8217;ll help folks get started with using &lt;a href="http://alestic.com/"&gt;Amazon EC2 and Ubuntu Linux&lt;/a&gt;.  More information about preparation will be posted on the &lt;a href="http://www.socallinuxexpo.org/scale8x/blog/amazon-ec2-try-it-lab-preparation-required"&gt;SCaLE blog&lt;/a&gt;, so be sure to review it before attending if you&amp;#8217;re interested in a hands-on, guided, workshop experience with EC2.  The lab seats &amp;#8220;sold out&amp;#8221; quickly last year, so make sure you get in early.&lt;/p&gt;

&lt;p&gt;Deal for readers of &lt;a href="http://alestic.com/"&gt;Alestic.com&lt;/a&gt;: When you &lt;a href="https://www.socallinuxexpo.org/reg7/"&gt;register for SCaLE&lt;/a&gt;, use the code &amp;#8220;&lt;code&gt;ERIC&lt;/code&gt;&amp;#8221; for 50% off of the listed price.  If you sign up today, that gives you a full access pass for a ridiculously low $35.  Prices may go up as the weekend gets closer.&lt;/p&gt;

&lt;p&gt;[Upate 2010-02-16: Link to preparation instructions on SCALE blog]&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/S4nOTCJN4y0" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2010/01/scale-ec2-tutorial</feedburner:origLink></entry>

<entry>
    <title>Public EBS Boot AMIs for Ubuntu on Amazon EC2</title>
    <link rel="alternate" type="text/html" href="http://feeds.alestic.com/~r/alestic/~3/BaIU0uBfZxw/public-ebs-boot-amis-for-ubuntu-on-amazon-ec2" />
    <id>tag:alestic.com,2010://1.79</id>

    <published>2010-01-25T14:33:58Z</published>
    <updated>2010-01-25T15:06:13Z</updated>

    <summary>If you’ve been following along, you probably know that I have been recommending that folks using EC2 switch to the official Ubuntu AMIs published by Canonical (Hardy or Karmic). I have been building and publishing Ubuntu AMIs since 2007 (including...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="amis" label="AMIs" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="canonical" label="Canonical" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ebsboot" label="EBS boot" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="hardy" label="Hardy" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="images" label="images" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="karmic" label="Karmic" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;If you&amp;#8217;ve been following along, you probably know that I have been recommending that folks using EC2 switch to the official Ubuntu AMIs published by Canonical (Hardy or Karmic).  I have been building and publishing Ubuntu AMIs since 2007 (including Dapper, Edgy, Feisty, Gutsy, Hardy, Intrepid, Karmic), but the last year my focus on this project has been to transition these responsibilities to Canonical who have more time and resources to support the initiative.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;m happy to say that I&amp;#8217;ve finally followed my own advice.  For my personal Amazon EC2 servers (including for the &lt;a href="http://alestic.com/"&gt;Alestic.com&lt;/a&gt; web site) I am using Ubuntu 9.10 Karmic images published for EC2 by Canonical.&lt;/p&gt;

&lt;p&gt;While I was making the transition, I also switched to &lt;a href="http://alestic.com/2010/01/ec2-ebs-boot-ubuntu"&gt;EBS boot AMIs&lt;/a&gt;.  However, since it sounds like Canonical is not planning to publish EBS boot AMIs until Lucid, I decided to continue in service to the community and make available EBS boot AMIs for running Ubuntu on EC2.&lt;/p&gt;

&lt;p&gt;I have published EBS boot AMIs for Ubuntu 9.10 Karmic and Ubuntu 8.04 Hardy, both 32- and 64-bit architectures, in all current EC2 regions, for a total of a dozen new AMIs.&lt;/p&gt;

&lt;p&gt;I chose to use the exact &lt;a href="http://uec-images.ubuntu.com/"&gt;Ubuntu images&lt;/a&gt; which Canonical built for running Ubuntu on EC2.  This means that these EBS boot AMIs work exactly the same as the official Canonical AMIs including ssh to the &lt;code&gt;ubuntu&lt;/code&gt; user.  Again, even though I&amp;#8217;m &lt;em&gt;publishing&lt;/em&gt; the EBS boot AMIs for Karmic and Hardy, the contents of the image were &lt;em&gt;built&lt;/em&gt; by Canonical.&lt;/p&gt;

&lt;p&gt;The EBS boot AMIs are listed on &lt;a href="http://alestic.com/"&gt;Alestic.com&lt;/a&gt;.  I have restructured the table to better feature Canonical AMIs, and now you need to pick an EC2 region to see the IDs.&lt;/p&gt;

&lt;p&gt;Give the EBS boot AMIs a spin and let me know if you run into any issues.&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/BaIU0uBfZxw" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2010/01/public-ebs-boot-amis-for-ubuntu-on-amazon-ec2</feedburner:origLink></entry>

<entry>
    <title>How to Report Bugs with Ubuntu on Amazon EC2: ubuntu-bug</title>
    <link rel="alternate" type="text/html" href="http://feeds.alestic.com/~r/alestic/~3/Pt_uBNsMg5o/ec2-ubuntu-bug" />
    <id>tag:alestic.com,2010://1.72</id>

    <published>2010-01-25T10:00:00Z</published>
    <updated>2010-01-26T03:08:39Z</updated>

    <summary>The official Ubuntu AMIs published by Canonical for EC2 starting in October have proven to be solid and production worthy. However, you may still on occasion run into an issue which deserves to be brought to the attention of the...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="apport" label="apport" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="bugs" label="bugs" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="defects" label="defects" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="launchpad" label="launchpad" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntubug" label="ubuntu-bug" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;The official Ubuntu AMIs published by Canonical for EC2 starting in October have proven to be solid and production worthy.  However, you may still on occasion run into an issue which deserves to be brought to the attention of the Ubuntu server team developing these AMIs and the software which enables Ubuntu integration with EC2.&lt;/p&gt;

&lt;p&gt;The easiest, most efficient, and most complete way to report problems with Ubuntu on EC2 is to use the &lt;code&gt;ubuntu-bug&lt;/code&gt; tool which comes pre-installed on all Ubuntu systems.&lt;/p&gt;

&lt;p&gt;The ubuntu-bug command requires a single argument which is one of: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;the name of an Ubuntu software package experiencing a problem, &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;the path to a program related to the problem, &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;the process id of the program experiencing the problem, or&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;the path of a crash file.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When reporting EC2 startup issues with an Ubuntu instance, the involved package is generally &lt;code&gt;ec2-init&lt;/code&gt; so the command to run would be:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ubuntu-bug ec2-init
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This command should be run on the EC2 instance that is experiencing the problem.  The ubuntu-bug command will collect relevant information about the instance and file it with the bug report to assist in tracking down and correcting the issue.&lt;/p&gt;

&lt;p&gt;If the instance with the problem is no longer running or accessible, try to run another instance of the same AMI to report the bug.  This will help submit the correct AMI information with the bug report.&lt;/p&gt;

&lt;p&gt;If &lt;code&gt;ubuntu-bug&lt;/code&gt; reports &amp;#8220;This is not a genuine Ubuntu package&amp;#8221; you might have to first run&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo apt-get update
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and then try again.&lt;/p&gt;

&lt;p&gt;Unfortunately, &lt;code&gt;ubuntu-bug&lt;/code&gt; is an interactive program which does not accept command line options to set choices, so you will need to respond to a couple prompts and then copy and paste a URL it provides to you.  First, it asks:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;What would you like to do? Your options are:
  S: Send report (1.5 KiB)
  V: View report
  K: Keep report file for sending later or copying to somewhere else
  C: Cancel
Please choose (S/V/K/C): S
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Respond by hitting the &amp;#8220;S&amp;#8221; key because you really do want to report a problem.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ubuntu-bug&lt;/code&gt; then displays a URL and asks if you would like to launch a browser.  &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Choices:
  1: Launch a browser now
  C: Cancel
Please choose (1/C): C
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Respond by hitting the &amp;#8220;C&amp;#8221; key as &lt;code&gt;ubuntu-bug&lt;/code&gt; running on the EC2 instance can&amp;#8217;t launch the web browser on your local system and you probably don&amp;#8217;t want to use a terminal based browser.&lt;/p&gt;

&lt;p&gt;Make a note of the URL displayed in:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;*** To continue, you must visit the following URL:
  https://bugs.launchpad.net/ubuntu/+source/ec2-init/+filebug/LONGSTRINGHERE?
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Copy the URL and paste it into your web browser.  You will continue reporting the problem through your browser and the system information will be attached after you submit.&lt;/p&gt;

&lt;p&gt;If this is the first time you have used Launchpad.net, you will be prompted to create an account.  Use a valid email address as you will need to confirm it.&lt;/p&gt;

&lt;p&gt;Launchpad will prompt you to enter a &amp;#8220;Summary&amp;#8221; which should be a short description of the bug.  If it is not a duplicate of one of the bugs already entered, click &amp;#8220;No I need to report a new bug&amp;#8221; and enter the &amp;#8220;Further Information&amp;#8221;.  Include as much information as possible relevant to the issue.  If a developer can reproduce the bug using this description, then it will be addressed more easily.&lt;/p&gt;

&lt;p&gt;For general information on submitting bugs in Ubuntu, please see:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="https://help.ubuntu.com/community/ReportingBugs"&gt;https://help.ubuntu.com/community/ReportingBugs&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can see also see a current list of &lt;a href="https://bugs.launchpad.net/bugs/+bugs?field.tag=ec2-images"&gt;open ec2-images bugs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you are reporting Ubuntu on EC2 bugs directly using Launchpad without &lt;code&gt;ubuntu-bug&lt;/code&gt; (&lt;a href="http://mdzlog.alcor.net/2009/03/31/please-dont-report-ubuntu-bugs-directly-to-launchpad/"&gt;not recommended&lt;/a&gt;) make sure you include the AMI id and tag the bug with &amp;#8220;ec2-images&amp;#8221;.&lt;/p&gt;

&lt;p&gt;Note that &lt;code&gt;ubuntu-bug&lt;/code&gt; is not a mechanism to support general support questions.  One place to get help with running Ubuntu on EC2 is from the community in the &lt;a href="http://groups.google.com/group/ec2ubuntu/"&gt;ec2ubuntu Google group&lt;/a&gt; and there&amp;#8217;s always the general &lt;a href="http://ec2forum.notlong.com/"&gt;Amazon EC2 forum&lt;/a&gt;.  You can occasionally get live help with Ubuntu on EC2 on the &lt;a href="irc://irc.freenode.net/#ubuntu-server"&gt;#ubuntu-server&lt;/a&gt; IRC channel on irc.freenode.net&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/Pt_uBNsMg5o" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2010/01/ec2-ubuntu-bug</feedburner:origLink></entry>

<entry>
    <title>Three Ways to Protect EC2 Instances from Accidental Termination and Loss of Data</title>
    <link rel="alternate" type="text/html" href="http://feeds.alestic.com/~r/alestic/~3/R8nAIKJOIEk/ec2-instance-locking" />
    <id>tag:alestic.com,2010://1.78</id>

    <published>2010-01-11T19:48:55Z</published>
    <updated>2010-01-25T03:10:11Z</updated>

    <summary>Here are a few little-publicized benefits that were launched with Amazon EC2’s new EBS boot instances: You can lock them from being accidentally terminated; you can prevent termination even when you try to shutdown the server from inside the instance;...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="api" label="API" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="deleteontermination" label="delete-on-termination" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ebs" label="EBS" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ebsboot" label="EBS boot" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="instanceattriutes" label="instance attriutes" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="instances" label="instances" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="locking" label="locking" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="snapshots" label="snapshots" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="termination" label="termination" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="volumes" label="volumes" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;Here are a few little-publicized benefits that were launched with Amazon EC2&amp;#8217;s new EBS boot instances: You can lock them from being accidentally terminated; you can prevent termination even when you try to shutdown the server from inside the instance; and you can automatically save your data storage when they are terminated.&lt;/p&gt;

&lt;p&gt;In discussions with other EC2 users, I&amp;#8217;ve found that it is a common feeling of near panic when you go to terminate an instance and you check very carefully to make sure that you are deleting the right instance instead of an active production system.  Slightly less common but even worse is the feeling of dread when you realize you just casually terminated the wrong EC2 instance.&lt;/p&gt;

&lt;p&gt;It is always recommended to set up your AWS architecture so that you are able to restart production systems on EC2 easily, as they could, in theory, be lost at any point due to hardware failure or other actions.  However, new features released with the EBS boot instances help reduce the risks associated with human error.&lt;/p&gt;

&lt;p&gt;The following examples will demonstrate with the EC2 API command line tools &lt;code&gt;ec2-run-instances&lt;/code&gt;, &lt;code&gt;ec2-modify-instance-attribute&lt;/code&gt;, and &lt;code&gt;ec2-terminate-instances&lt;/code&gt;.  Since AWS is Amazon&amp;#8217;s &amp;#8220;web service&amp;#8221; all of these features are also available through the API and should be coming available (if they aren&amp;#8217;t already) in other tools, packages, and interfaces using the web service API.&lt;/p&gt;

&lt;h2&gt;1. Shutdown Behavior&lt;/h2&gt;

&lt;p&gt;First, let&amp;#8217;s look at what happens when you run a command like the following in an EC2 instance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo shutdown -h now
# or, equivalently and much easier to type:
sudo halt
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Using the legacy S3 based AMIs, either of the above terminates the instance and you lose all local and ephemeral storage (boot disk and /mnt) forever.  Hope you remembered to save the important stuff elsewhere!&lt;/p&gt;

&lt;p&gt;A shutdown from within an EBS boot instance, by default, will initiate a &amp;#8220;stop&amp;#8221; instead of a &amp;#8220;terminate&amp;#8221;.  This means that your instance is not in a running state and not getting charged, but the EBS volumes still exist and you can &amp;#8220;start&amp;#8221; the same instance id again later, losing nothing.&lt;/p&gt;

&lt;p&gt;You can explicitly set or change this with the &lt;code&gt;--instance-initiated-shutdown-behavior&lt;/code&gt; option in &lt;code&gt;ec2-run-instances&lt;/code&gt;.  For example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-run-instances                             \
  --instance-initiated-shutdown-behavior stop \
  [...]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This is the first safety precaution and, as mentioned, should already be built in, though it doesn&amp;#8217;t hurt to document your intentions with an explicit option.&lt;/p&gt;

&lt;h2&gt;2. Delete on Termination&lt;/h2&gt;

&lt;p&gt;Though EBS volumes created and attached to an instance at instantiation are preserved through a &amp;#8220;stop&amp;#8221;/&amp;#8221;start&amp;#8221; cycle, by default they are destroyed and lost when an EC2 instance is terminated.  This behavior can be changed with a &lt;code&gt;delete-on-termination&lt;/code&gt; boolean value buried in the documentation for the &lt;code&gt;--block-device-mapping&lt;/code&gt; option of &lt;code&gt;ec2-run-instances&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Here is an example that says &amp;#8220;Don&amp;#8217;t delete the root EBS volume when this instance is terminated&amp;#8221;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-run-instances                          \
  --block-device-mapping /dev/sda1=::false \
  [...]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you are associating other EBS snapshots with the instance at run time, you can also specify that those created EBS volumes should be preserved past the lifetime of the instance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  --block-device-mapping /dev/sdh=SNAPSHOTID::false
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;When you use these options, you&amp;#8217;ll need to manually clean up the EBS volume(s) if you no longer want to pay for the storage costs after an instance is gone.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: EBS volumes attached to an instance &lt;strong&gt;after&lt;/strong&gt; it is already running are, by default, left alone on termination (i.e., not deleted).  The default rules are: If the EBS volume is created by the creation of the instance, then the termination of the instance deletes the volumes.  If you created the volume explicitly, then you must delete it explicitly.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;3. Disable Termination&lt;/h2&gt;

&lt;p&gt;This is my favorite new safety feature.  Years ago, I asked Amazon for the ability to lock an EC2 instance from being accidentally terminated, and with the launch of EBS boot instances, this is now possible.  Using &lt;code&gt;ec2-run-instances&lt;/code&gt;, the key option is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-run-instances           \
  --disable-api-termination \
  [...]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now, if you try to terminate the instance, you will get an error like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Client.OperationNotPermitted: The instance 'i-XXXXXXXX' may not be terminated.
Modify its 'disableApiTermination' instance attribute and try again.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Yay!&lt;/p&gt;

&lt;p&gt;To unlock the instance and allow termination through the API, use a command like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-modify-instance-attribute     \
  --disable-api-termination false \
  INSTANCEID
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then end it all with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-terminate-instances INSTANCEID
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Oh, wait!  did you make sure you unlocked and terminated the right instance?! :)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: disableApiTermination is also available when you run S3 based AMIs today, but since the instance can still be terminated from inside (shutdown/halt) I am moving towards EBS based instances for all around security.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;Put It Together&lt;/h2&gt;

&lt;p&gt;Here&amp;#8217;s a command line I just used to start up an EC2 instance of an Ubuntu 9.10 Karmic EBS boot AMI which I intend to use as a long-term production server with strong uptime and data safety requirements.  I wanted to add all the protection available:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-run-instances                                    \
  --key $keypair                                     \
  --availability-zone $availabilityzone              \
  --user-data-file $startupscript                    \
  --block-device-mapping /dev/sda1=::false           \
  --block-device-mapping /dev/sdh=$snapshotid::false \
  --instance-initiated-shutdown-behavior stop        \
  --disable-api-termination                          \
  $amiid
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;With regular &lt;a href="http://alestic.com/2009/09/ec2-consistent-snapshot"&gt;EBS snapshots of the volumes&lt;/a&gt;, copies to off site backups, and documented/automated restart processes, I feel pretty safe.&lt;/p&gt;

&lt;h2&gt;Runtime Modification&lt;/h2&gt;

&lt;p&gt;If you have a valuable running EC2 instance, but forgot to specify the above options to protect it when you started it, or you are now ready to turn a test system into a production system, you can still lock things after the fact using the &lt;code&gt;ec2-modify-instance-attribute&lt;/code&gt; command (or equivalent API call).  &lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-modify-instance-attribute --disable-api-termination true INSTANCEID
ec2-modify-instance-attribute --instance-initiated-shutdown-behavior stop INSTANCEID
ec2-modify-instance-attribute --block-device-mapping /dev/sda1=::false INSTANCEID
ec2-modify-instance-attribute --block-device-mapping /dev/sdh=::false INSTANCEID
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Only one type of option can be specified with each invocation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;--disable-api-termination&lt;/code&gt; option has no argument value when used in in &lt;code&gt;ec2-run-instances&lt;/code&gt;, but it takes a value of &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt; in &lt;code&gt;ec2-modify-instance-attribute&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You don&amp;#8217;t specify the snapshot id when changing the delete-on-terminate state of an attached EBS volume.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You may change the delete-on-terminate to &amp;#8220;true&amp;#8221; for an EBS volume you created and attached after the instance was running.  By default it will not be deleted since you created it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The above &lt;code&gt;--block-device-mapping&lt;/code&gt; options currently generate a Server.InternalError for me.  I &lt;a href="http://developer.amazonwebservices.com/connect/thread.jspa?threadID=41042"&gt;reported it to Amazon&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can find out the current state of the options using &lt;code&gt;ec2-describe-instance-attribute&lt;/code&gt;, which only takes one option at a time:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-describe-instance-attribute --disable-api-termination INSTANCEID
ec2-describe-instance-attribute --instance-initiated-shutdown-behavior INSTANCEID
ec2-describe-instance-attribute --block-device-mapping INSTANCEID
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Unfortunately, the block-device-mapping output does not currently show the state of delete-on-termination value, but thanks to Andrew Lusk for pointing out in a comment below that it is available through the API.  Here&amp;#8217;s a hack which extracts the information from the debug output:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-describe-instance-attribute -v --block-device-mapping INSTANCEID | 
  perl -0777ne 'print "$1\t$2\t$3\n" while 
  m%&amp;lt;deviceName&amp;gt;(.*?)&amp;lt;.*?&amp;lt;volumeId&amp;gt;(.*?)&amp;lt;.*?&amp;lt;deleteOnTermination&amp;gt;(.*?)&amp;lt;%sg'
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;While we&amp;#8217;re on the topic of EC2 safety, I should mention the well known best practice of separating development and production systems by using a different AWS account for each.  Amazon lets you create and use as many accounts as you&amp;#8217;d like even with the same credit card as long as you use a unique email address for each.  Now that you can share EBS snapshots between accounts, this practice is even more useful.&lt;/p&gt;

&lt;p&gt;What additional safety precautions do you take with your EC2 instances and data?&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/R8nAIKJOIEk" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2010/01/ec2-instance-locking</feedburner:origLink></entry>

<entry>
    <title>Building EBS Boot AMIs Using Canonical's Downloadable EC2 Images</title>
    <link rel="alternate" type="text/html" href="http://feeds.alestic.com/~r/alestic/~3/oC8NsMyGWog/ec2-ebs-boot-ubuntu" />
    <id>tag:alestic.com,2010://1.77</id>

    <published>2010-01-06T13:19:58Z</published>
    <updated>2010-01-22T23:24:18Z</updated>

    <summary>In the last article, I described how to use the vmbuilder software to build an EBS boot AMI from scratch for running Ubuntu on EC2 with a persistent root disk. In the ec2ubuntu Google group, Scott Moser pointed out that...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="amis" label="AMIs" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="building" label="building" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="canonical" label="Canonical" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ebsboot" label="EBS boot" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="images" label="images" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntuonec2" label="ubuntu-on-ec2" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;In the last article, I described how to use the &lt;code&gt;vmbuilder&lt;/code&gt; software to &lt;a href="http://alestic.com/2010/01/vmbuilder-ebs-boot-ami"&gt;build an EBS boot AMI from scratch&lt;/a&gt; for running Ubuntu on EC2 with a persistent root disk.&lt;/p&gt;

&lt;p&gt;In the &lt;a href="http://groups.google.com/group/ec2ubuntu/browse_thread/thread/fa0fdc3941d75107/5fee22cf2cb918ad#5fee22cf2cb918ad"&gt;ec2ubuntu Google group&lt;/a&gt;, Scott Moser pointed out that users can take advantage of the Ubuntu images for EC2 that Canonical has already built with vmbuilder.  This can simplify and speed up the process of building EBS boot AMIs for the rest of us.&lt;/p&gt;

&lt;p&gt;Let&amp;#8217;s walk through the steps, creating an EBS boot AMI for Ubuntu 9.10 Karmic.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Run an instance of the Ubuntu 9.10 Karmic AMI, either 32-bit or 64-bit depending on which architecture AMI you wish to build.  Make a note of the resulting instance id:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# 32-bit
instanceid=$(ec2-run-instances   \
  --key YOURKEYPAIR              \
  --availability-zone us-east-1a \
  ami-1515f67c |
  egrep ^INSTANCE | cut -f2)
echo "instanceid=$instanceid"


# 64-bit
instanceid=$(ec2-run-instances   \
  --key YOURKEYPAIR              \
  --availability-zone us-east-1a \
  --instance-type m1.large       \
  ami-ab15f6c2 |
  egrep ^INSTANCE | cut -f2)
echo "instanceid=$instanceid"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Wait for the instance to move to the &amp;#8220;running&amp;#8221; state, then note the public hostname:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;while host=$(ec2-describe-instances "$instanceid" | 
  egrep ^INSTANCE | cut -f4) &amp;amp;&amp;amp; test -z $host; do echo -n .; sleep 1; done
echo host=$host
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Copy your X.509 certificate and private key to the instance.  Use the correct locations for your &lt;a href="http://alestic.com/2009/11/ec2-credentials"&gt;credential files&lt;/a&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;rsync                            \
  --rsh="ssh -i YOURKEYPAIR.pem" \
  --rsync-path="sudo rsync"      \
  ~/.ec2/{cert,pk}-*.pem         \
  ubuntu@$host:/mnt/
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Connect to the instance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ssh -i YOURKEYPAIR.pem ubuntu@$host
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install EC2 API tools from the &lt;a href="http://ppa.launchpad.net/ubuntu-on-ec2/ec2-tools/"&gt;Ubuntu on EC2 ec2-tools PPA&lt;/a&gt; because they are more up to date than the ones in Karmic, letting us register EBS boot AMIs:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;export DEBIAN_FRONTEND=noninteractive
echo "deb http://ppa.launchpad.net/ubuntu-on-ec2/ec2-tools/ubuntu karmic main" |
  sudo tee /etc/apt/sources.list.d/ubuntu-on-ec2-ec2-tools.list &amp;amp;&amp;amp;
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9EE6D873 &amp;amp;&amp;amp;
sudo apt-get update &amp;amp;&amp;amp;
sudo -E apt-get dist-upgrade -y &amp;amp;&amp;amp;
sudo -E apt-get install -y ec2-api-tools
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set up some parameters:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;codename=karmic
release=9.10
tag=server
if [ $(uname -m) = 'x86_64' ]; then
  arch=x86_64
  arch2=amd64
  ebsopts="--kernel=aki-fd15f694 --ramdisk=ari-c515f6ac"
  ebsopts="$ebsopts --block-device-mapping /dev/sdb=ephemeral0"
else
  arch=i386
  arch2=i386
  ebsopts="--kernel=aki-5f15f636 --ramdisk=ari-0915f660"
  ebsopts="$ebsopts --block-device-mapping /dev/sda2=ephemeral0"
fi
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Download and unpack the latest released Ubuntu server image file.  This contains the output of &lt;code&gt;vmbuilder&lt;/code&gt; as run by Canonical.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;imagesource=http://uec-images.ubuntu.com/releases/$codename/release/unpacked/ubuntu-$release-$tag-uec-$arch2.img.tar.gz
image=/mnt/$codename-uec-$arch2.img
imagedir=/mnt/$codename-uec-$arch2
wget -O- $imagesource |
  sudo tar xzf - -C /mnt
sudo mkdir -p $imagedir
sudo mount -o loop $image $imagedir
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;[OPTIONAL]&lt;/em&gt;  At this point &lt;code&gt;/mnt/$image&lt;/code&gt; contains a mounted filesystem with the complete Ubuntu image as released by Canonical. You can skip this step if you just want an EBS boot AMI which is an exact copy of the released S3 based Ubuntu AMI from Canonical, or you can make any updates, installations, and customizations you&amp;#8217;d like to have in your resulting AMI.&lt;/p&gt;

&lt;p&gt;In this example, we&amp;#8217;ll perform similar steps as the previous tutorial and update the software packages to the latest releases from Ubuntu.  Remember that the released EC2 image could be months old.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# Allow network access from chroot environment
sudo cp /etc/resolv.conf $imagedir/etc/
# Fix what I consider to be a bug in vmbuilder
sudo rm -f $imagedir/etc/hostname
# Add multiverse
sudo perl -pi -e 's%(universe)$%$1 multiverse%' \
  $imagedir/etc/ec2-init/templates/sources.list.tmpl
# Add Alestic PPA for runurl package (handy in user-data scripts)
echo "deb http://ppa.launchpad.net/alestic/ppa/ubuntu karmic main" |
  sudo tee $imagedir/etc/apt/sources.list.d/alestic-ppa.list
sudo chroot $imagedir \
  apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BE09C571
# Add ubuntu-on-ec2/ec2-tools PPA for updated ec2-ami-tools
echo "deb http://ppa.launchpad.net/ubuntu-on-ec2/ec2-tools/ubuntu karmic main" |
  sudo tee $imagedir/etc/apt/sources.list.d/ubuntu-on-ec2-ec2-tools.list
sudo chroot $imagedir \
  apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9EE6D873
# Upgrade the system and install packages
sudo chroot $imagedir mount -t proc none /proc
sudo chroot $imagedir mount -t devpts none /dev/pts
cat &amp;lt;&amp;lt;EOF &amp;gt; $imagedir/usr/sbin/policy-rc.d
#!/bin/sh
exit 101
EOF
chmod 755 $imagedir/usr/sbin/policy-rc.d
DEBIAN_FRONTEND=noninteractive
sudo chroot $imagedir apt-get update &amp;amp;&amp;amp;
sudo -E chroot $imagedir apt-get dist-upgrade -y &amp;amp;&amp;amp;
sudo -E chroot $imagedir apt-get install -y runurl ec2-ami-tools
sudo chroot $imagedir umount /proc
sudo chroot $imagedir umount /dev/pts
rm -f $imagedir/usr/sbin/policy-rc.d
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Again, the above step is completely optional and can be skipped to create the EBS boot AMI that Canonical would have published.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy the image files to a new EBS volume, snapshot it, and register the snapshot as an EBS boot AMI.  Make a note of the resulting AMI id:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;size=15 # root disk in GB
now=$(date +%Y%m%d-%H%M)
prefix=ubuntu-$release-$codename-$tag-$arch-$now
description="Ubuntu $release $codename $tag $arch $now"
export EC2_CERT=$(echo /mnt/cert-*.pem)
export EC2_PRIVATE_KEY=$(echo /mnt/pk-*.pem)
volumeid=$(ec2-create-volume --size $size --availability-zone us-east-1a |
  cut -f2)
instanceid=$(wget -qO- http://instance-data/latest/meta-data/instance-id)
ec2-attach-volume --device /dev/sdi --instance "$instanceid" "$volumeid"
while [ ! -e /dev/sdi ]; do echo -n .; sleep 1; done
sudo mkfs.ext3 -F /dev/sdi
ebsimage=$imagedir-ebs
sudo mkdir $ebsimage
sudo mount /dev/sdi $ebsimage
sudo tar -cSf - -C $imagedir . | sudo tar xvf - -C $ebsimage
sudo umount $ebsimage
ec2-detach-volume "$volumeid"
snapshotid=$(ec2-create-snapshot "$volumeid" | cut -f2)
ec2-delete-volume "$volumeid"
while ec2-describe-snapshots "$snapshotid" | grep -q pending
  do echo -n .; sleep 1; done
ec2-register                   \
  --architecture $arch         \
  --name "$prefix"             \
  --description "$description" \
  $ebsopts                     \
  --snapshot "$snapshotid"
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Depending on what you want to keep from the above process, there are various things that you might want to clean up.&lt;/p&gt;

&lt;p&gt;If you no longer want to use an EBS boot AMI:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-deregister $amiid
ec2-delete-snapshot $snapshotid
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;When you&amp;#8217;re done with the original instance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-terminate-instance $instanceid
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In this example, I set &lt;code&gt;/mnt&lt;/code&gt; to the first ephemeral store on the instance even on EBS boot AMIs.  This more closely matches the default on the S3 based AMIs, but means that &lt;code&gt;/mnt&lt;/code&gt; will &lt;em&gt;not&lt;/em&gt; be persistent across a stop/start of an EBS boot instance.  If Canonical starts publishing EBS boot AMIs, they may or may not choose to make the same choice.&lt;/p&gt;

&lt;p&gt;Community feedback, bug reports, and enhancements for these instructions are welcomed.&lt;/p&gt;

&lt;p&gt;[Update 2009-01-14: Wrapped upgrade/installs inside of /usr/sbin/policy-rc.d setting to avoid starting daemons in chroot environment.]&lt;/p&gt;

&lt;p&gt;[Update 2010-01-22: New location for downloadable Ubuntu images.]&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/oC8NsMyGWog" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2010/01/ec2-ebs-boot-ubuntu</feedburner:origLink></entry>

<entry>
    <title>Building EBS Boot and S3 Based AMIs for EC2 with Ubuntu vmbuilder</title>
    <link rel="alternate" type="text/html" href="http://feeds.alestic.com/~r/alestic/~3/PauGSk3Q62c/vmbuilder-ebs-boot-ami" />
    <id>tag:alestic.com,2010://1.74</id>

    <published>2010-01-04T11:33:33Z</published>
    <updated>2010-01-04T11:35:59Z</updated>

    <summary>Here’s my current recipe for how to build an Ubuntu 9.10 Karmic AMI, either the new EBS boot or the standard S3 based, using the Ubuntu vmbuilder software. The Ubuntu vmbuilder utility replaces ec2ubuntu-build-ami for building EC2 images and it...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="amis" label="AMIs" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="building" label="building" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ebsboot" label="EBS boot" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2amitools" label="ec2-ami-tools" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2apitools" label="ec2-api-tools" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="images" label="images" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="s3based" label="S3 based" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntuonec2" label="ubuntu-on-ec2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="vmbuilder" label="vmbuilder" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;Here&amp;#8217;s my current recipe for how to build an Ubuntu 9.10 Karmic AMI, either the new EBS boot or the standard S3 based, using the Ubuntu vmbuilder software.  The Ubuntu vmbuilder utility replaces &lt;a href="http://alestic.com/2007/11/ec2ubuntu-build-ami"&gt;ec2ubuntu-build-ami&lt;/a&gt; for building EC2 images and it can build images for a number of other virtual machine formats as well.&lt;/p&gt;

&lt;p&gt;There is a lot of room for simplification and scripting in the following instructions, but I figured I&amp;#8217;d publish what is working now so others can take advantage of the research to date.  Happy New Year!&lt;/p&gt;

&lt;p&gt;Some sections are marked &lt;em&gt;[For EBS boot AMI]&lt;/em&gt; or &lt;em&gt;[For S3 based AMI]&lt;/em&gt; and should only be followed when you are building that type of AMI.  The rest of the sections apply to either type.  It is possible to follow all instructions to build both types of AMIs at the same time.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Run an instance of Ubuntu 9.10 Karmic AMI, either 32-bit or 64-bit depending on which architecture AMI you wish to build.   I prefer the &lt;code&gt;c1.*&lt;/code&gt; instance types to speed up the builds, but you can get by cheaper with the &lt;code&gt;m1.*&lt;/code&gt; instance types.  Make a note of the resulting instance id:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# 32-bit
instanceid=$(ec2-run-instances   \
  --key YOURKEYPAIR              \
  --availability-zone us-east-1a \
  --instance-type c1.medium      \
  ami-1515f67c |
  egrep ^INSTANCE | cut -f2)
echo "instanceid=$instanceid"


# 64-bit
instanceid=$(ec2-run-instances   \
  --key YOURKEYPAIR              \
  --availability-zone us-east-1a \
  --instance-type c1.xlarge      \
  ami-ab15f6c2 |
  egrep ^INSTANCE | cut -f2)
echo "instanceid=$instanceid"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Wait for the instance to move to the &amp;#8220;running&amp;#8221; state, then note the public hostname:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;while host=$(ec2-describe-instances "$instanceid" | 
  egrep ^INSTANCE | cut -f4) &amp;amp;&amp;amp; test -z $host; do echo -n .; sleep 1; done
echo host=$host
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy your X.509 certificate and private key to the instance.  Use the correct locations for your &lt;a href="http://alestic.com/2009/11/ec2-credentials"&gt;credential files&lt;/a&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;rsync                            \
  --rsh="ssh -i YOURKEYPAIR.pem" \
  --rsync-path="sudo rsync"      \
  ~/.ec2/{cert,pk}-*.pem         \
  ubuntu@$host:/mnt/
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Connect to the instance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ssh -i YOURKEYPAIR.pem ubuntu@$host
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install the image building software.  We install the &lt;code&gt;python-vm-builder&lt;/code&gt; package from Karmic, but we&amp;#8217;re going to be using the latest &lt;code&gt;vmbuilder&lt;/code&gt; from the development branch in Launchpad because it has good bug fixes.  We also use the EC2 API tools from the Ubuntu on EC2 ec2-tools PPA because they are more up to date than the ones in Karmic, letting us register EBS boot AMIs:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;export DEBIAN_FRONTEND=noninteractive
echo "deb http://ppa.launchpad.net/ubuntu-on-ec2/ec2-tools/ubuntu karmic main" |
  sudo tee /etc/apt/sources.list.d/ubuntu-on-ec2-ec2-tools.list &amp;amp;&amp;amp;
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9EE6D873 &amp;amp;&amp;amp;
sudo apt-get update &amp;amp;&amp;amp;
sudo -E apt-get upgrade -y &amp;amp;&amp;amp;
sudo -E apt-get install -y \
  python-vm-builder ec2-ami-tools ec2-api-tools bzr &amp;amp;&amp;amp;
bzr branch lp:vmbuilder
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You can ignore the &amp;#8220;Launchpad ID&amp;#8221; warning from bzr.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fill in your AWS credentials:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;export AWS_USER_ID=...
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
export EC2_CERT=$(echo /mnt/cert-*.pem)
export EC2_PRIVATE_KEY=$(echo /mnt/pk-*.pem)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Set up parameters and create files to be used by the build process.  The bucket value is only required for S3 based AMIs:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;bucket=...
codename=karmic
release=9.10
tag=server
if [ $(uname -m) = 'x86_64' ]; then
  arch=x86_64
  arch2=amd64
  pkgopts="--addpkg=libc6-i386"
  kernelopts="--ec2-kernel=aki-fd15f694 --ec2-ramdisk=ari-c515f6ac"
  ebsopts="--kernel=aki-fd15f694 --ramdisk=ari-c515f6ac"
  ebsopts="$ebsopts --block-device-mapping /dev/sdb=ephemeral0"
else
  arch=i386
  arch2=i386
  pkgopts=
  kernelopts="--ec2-kernel=aki-5f15f636 --ec2-ramdisk=ari-0915f660"
  ebsopts="--kernel=aki-5f15f636 --ramdisk=ari-0915f660"
  ebsopts="$ebsopts --block-device-mapping /dev/sda2=ephemeral0"
fi
cat &amp;gt; part-i386.txt &amp;lt;&amp;lt;EOM
root 10240 a1
/mnt 1 a2
swap 1024 a3
EOM
cat &amp;gt; part-x86_64.txt &amp;lt;&amp;lt;EOM
root 10240 a1
/mnt 1 b
EOM
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a script to perform local customizations to the image before it is bundled.  This is passed to &lt;code&gt;vmbuilder&lt;/code&gt; below using the &lt;code&gt;--execscript&lt;/code&gt; option:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cat &amp;gt; setup-server &amp;lt;&amp;lt;'EOM'
#!/bin/bash -ex
imagedir=$1
# fix what I consider to be bugs in vmbuilder
perl -pi -e "s%^127.0.1.1.*\n%%" $imagedir/etc/hosts
rm -f $imagedir/etc/hostname
# Use multiverse
perl -pi -e 's%(universe)$%$1 multiverse%' \
  $imagedir/etc/ec2-init/templates/sources.list.tmpl
# Add Alestic PPA for runurl package (handy in user-data scripts)
echo "deb http://ppa.launchpad.net/alestic/ppa/ubuntu karmic main" |
  tee $imagedir/etc/apt/sources.list.d/alestic-ppa.list
chroot $imagedir \
  apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BE09C571
# Add ubuntu-on-ec2/ec2-tools PPA for updated ec2-ami-tools
echo "deb http://ppa.launchpad.net/ubuntu-on-ec2/ec2-tools/ubuntu karmic main" |
  sudo tee $imagedir/etc/apt/sources.list.d/ubuntu-on-ec2-ec2-tools.list
chroot $imagedir \
  sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9EE6D873
# Install packages
chroot $imagedir apt-get update
chroot $imagedir apt-get install -y runurl
chroot $imagedir apt-get install -y ec2-ami-tools
EOM
chmod 755 setup-server
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Build the image:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;now=$(date +%Y%m%d-%H%M)
dest=/mnt/dest-$codename-$now
prefix=ubuntu-$release-$codename-$arch-$tag-$now
description="Ubuntu $release $codename $arch $tag $now"
sudo vmbuilder/vmbuilder xen ubuntu       \
  --suite=$codename                       \
  --arch=$arch2                           \
  --dest=$dest                            \
  --tmp=/mnt                              \
  --ec2                                   \
  --ec2-version="$description"            \
  --manifest=$prefix.manifest             \
  --lock-user                             \
  --part=part-$arch.txt                   \
  $kernelopts                             \
  $pkgopts                                \
  --execscript ./setup-server             \
  --debug
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;em&gt;[For S3 based AMI]&lt;/em&gt; include the following options in the vmbuilder command above. This does not preclude you from also building an EBS boot AMI with the same image.  Make a note of the resulting AMI id output by vmbuilder:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  --ec2-bundle                            \
  --ec2-upload                            \
  --ec2-register                          \
  --ec2-bucket=$bucket                    \
  --ec2-prefix=$prefix                    \
  --ec2-user=$AWS_USER_ID                 \
  --ec2-cert=$EC2_CERT                    \
  --ec2-key=$EC2_PRIVATE_KEY              \
  --ec2-access-key=$AWS_ACCESS_KEY_ID     \
  --ec2-secret-key=$AWS_SECRET_ACCESS_KEY \
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;[For EBS boot AMI]&lt;/em&gt; Copy the image files to a new EBS volume, snapshot it, and register the snapshot as an EBS boot AMI.  Make a note of the resulting AMI id:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;size=15 # root disk in GB
volumeid=$(ec2-create-volume --size $size --availability-zone us-east-1a |
  cut -f2)
instanceid=$(wget -qO- http://instance-data/latest/meta-data/instance-id)
ec2-attach-volume --device /dev/sdi --instance "$instanceid" "$volumeid"
while [ ! -e /dev/sdi ]; do echo -n .; sleep 1; done
sudo mkfs.ext3 -F /dev/sdi
ebsimage=$dest/ebs
sudo mkdir $ebsimage
sudo mount /dev/sdi $ebsimage
imageroot=$dest/root
sudo mkdir $imageroot
sudo mount -oloop $dest/root.img $imageroot
sudo tar -cSf - -C $imageroot . | sudo tar xvf - -C $ebsimage
sudo umount $imageroot $ebsimage
ec2-detach-volume "$volumeid"
snapshotid=$(ec2-create-snapshot "$volumeid" | cut -f2)
ec2-delete-volume "$volumeid"
while ec2-describe-snapshots "$snapshotid" | grep -q pending
  do echo -n .; sleep 1; done
ec2-register                   \
  --architecture $arch         \
  --name "$prefix"             \
  --description "$description" \
  $ebsopts                     \
  --snapshot "$snapshotid"
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Depending on what you want to keep from the above process, there are various things that you might want to clean up.&lt;/p&gt;

&lt;p&gt;If you no longer want to use an S3 based AMI:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-deregister $amiid
ec2-delete-bundle                     \
  --access-key $AWS_ACCESS_KEY_ID     \
  --secret-key $AWS_SECRET_ACCESS_KEY \
  --bucket $bucket                    \
  --prefix $prefix
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you no longer want to use an EBS boot AMI:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-deregister $amiid
ec2-delete-snapshot $snapshotid
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;When you&amp;#8217;re done with the original instance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-terminate-instance $instanceid
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the above instructions I stray a bit from the defaults. For example, I add the &lt;a href="http://alestic.com/2009/08/runurl"&gt;runurl&lt;/a&gt; package from the &lt;a href="https://launchpad.net/~alestic/+archive/ppa"&gt;Alestic PPA&lt;/a&gt; so that it is available for use in &lt;a href="http://alestic.com/2009/06/ec2-user-data-scripts"&gt;user-data scripts&lt;/a&gt; on first boot.  I enable &lt;code&gt;multiverse&lt;/code&gt; for easy access to more software, and I install &lt;code&gt;ec2-ami-tools&lt;/code&gt; which works better for me than the current &lt;code&gt;euca2ools&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I also set &lt;code&gt;/mnt&lt;/code&gt; to the first ephemeral store on the instance even on EBS boot AMIs.  This more closely matches the default on the S3 based AMIs, but means that &lt;code&gt;/mnt&lt;/code&gt; will &lt;em&gt;not&lt;/em&gt; be persistent across a stop/start of an EBS boot instance.&lt;/p&gt;

&lt;p&gt;Explore and set options as you see fit for your applications.  Go wild with the &lt;code&gt;--execscript&lt;/code&gt; feature (similar to the &lt;code&gt;ec2ubuntu-build-ami --script&lt;/code&gt; option) to customize your image.&lt;/p&gt;

&lt;p&gt;The following &lt;code&gt;vmbuilder&lt;/code&gt; options do not currently work with creating EC2 images: &lt;code&gt;--mirror&lt;/code&gt;, &lt;code&gt;--components&lt;/code&gt;, &lt;code&gt;--ppa&lt;/code&gt;.  I have submitted &lt;a href="https://bugs.launchpad.net/ubuntu/+source/ec2-init/+bug/502490"&gt;bug 502490&lt;/a&gt; to track this.&lt;/p&gt;

&lt;p&gt;As with much of my work here, I&amp;#8217;m simply explaining how to use software that others have spent a lot of energy building.  In this case a lot of thanks go to the Ubuntu server team for developing vmbuilder, the EC2 plugin, the ec2-init startup software, and the code which builds the official Ubuntu AMIs; especially Søren Hansen, Scott Moser, and Chuck Short.  I also appreciate the folks who reviewed early copies of these instructions and provided feedback including Scott Moser, Art Zemon, Trifon Trifonov, Vaibhav Puranik, and Chris.&lt;/p&gt;

&lt;p&gt;Community feedback, bug reports, and enhancements for these instructions are welcomed.&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/PauGSk3Q62c" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2010/01/vmbuilder-ebs-boot-ami</feedburner:origLink></entry>

<entry>
    <title>Call for testers (building EBS boot AMIs with Ubuntu vmbuilder)</title>
    <link rel="alternate" type="text/html" href="http://feeds.alestic.com/~r/alestic/~3/NLAlAVDUwrE/call-for-testers-building-ebs-boot-amis-with-ubuntu-vmbuilder" />
    <id>tag:alestic.com,2010://1.75</id>

    <published>2010-01-01T11:21:29Z</published>
    <updated>2010-01-01T11:30:11Z</updated>

    <summary>I’m polishing up an article about how to build images from scratch with Ubuntu vmbuilder, both for S3 based AMIs and for EBS boot AMIs. Since nobody is paying any attention this new year’s weekend (except for you seven and...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="vmbuilder" label="vmbuilder" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;I&amp;#8217;m polishing up an article about how to build images from scratch with Ubuntu vmbuilder, both for S3 based AMIs and for EBS boot AMIs.  Since nobody is paying any attention this new year&amp;#8217;s weekend (except for you seven and you know who you are) I figured I&amp;#8217;d wait until Monday or so to publish the article.&lt;/p&gt;

&lt;p&gt;However, if you have nothing better to do this long weekend and you&amp;#8217;d like a preview copy of the article, &lt;a href="http://www.anvilon.com/contact/"&gt;drop me a note&lt;/a&gt; with your email address.  All I ask for in return is that you review (and perhaps even test) the instructions and send me feedback where things aren&amp;#8217;t clear or don&amp;#8217;t work.&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/NLAlAVDUwrE" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2010/01/call-for-testers-building-ebs-boot-amis-with-ubuntu-vmbuilder</feedburner:origLink></entry>

<entry>
    <title>ec2-consistent-snapshot release 0.1-9</title>
    <link rel="alternate" type="text/html" href="http://feeds.alestic.com/~r/alestic/~3/XMShMJ42vRY/ec2-consistent-snapshot" />
    <id>tag:alestic.com,2009://1.71</id>

    <published>2009-12-18T01:49:21Z</published>
    <updated>2009-12-18T02:03:06Z</updated>

    <summary>Thanks to everybody who submitted bug reports and feature requests for ec2-consistent-snapshot, software which can be used to create consistent EBS snapshots on Amazon EC2 especially for use with XFS and/or MySQL. A new release (0.1-9) has been published to...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="alesticppa" label="Alestic PPA" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ebs" label="EBS" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2consistentsnapshot" label="ec2-consistent-snapshot" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ppa" label="PPA" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="snapshots" label="snapshots" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;Thanks to everybody who submitted bug reports and feature requests for &lt;a href="http://alestic.com/2009/09/ec2-consistent-snapshot"&gt;ec2-consistent-snapshot&lt;/a&gt;, software which can be used to create consistent EBS snapshots on Amazon EC2 especially for use with XFS and/or MySQL.  &lt;/p&gt;

&lt;p&gt;A new release (0.1-9) has been published to the &lt;a href="https://launchpad.net/~alestic/+archive/ppa"&gt;Alestic PPA&lt;/a&gt;.  This release provides the following fixes and enhancements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Read MySQL &amp;#8220;host&amp;#8221; parameter from .my.cnf if provided.
(closes: bug#485978)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Support quoted values in .my.cnf
(closes: bug#454184)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Require Net::Amazon::EC2 version 0.11 or higher.
(closes: bug#490686)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Require xfsprogs package.
(closes: bug#493420)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Replace &amp;#8220;/etc/init.d/mysql stop&amp;#8221; with &amp;#8220;mysqladmin shutdown&amp;#8221;.
(closes: bug#497557)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Document &amp;#8212;description option which was added earlier.
(closes: bug#487692)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you already have ec2-consistent-snapshot installed, you can upgrade using commands like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo apt-get update
sudo apt-get install ec2-consistent-snapshot
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you don&amp;#8217;t yet have the Alestic PPA set up, run these commands first:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;codename=$(lsb_release -cs)
echo "deb http://ppa.launchpad.net/alestic/ppa/ubuntu $codename main"|
  sudo tee /etc/apt/sources.list.d/alestic-ppa.list    
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BE09C571
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you find bugs or think of feature requests, please &lt;a href="https://bugs.launchpad.net/ec2-consistent-snapshot/+bugs"&gt;submit them&lt;/a&gt;.&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/XMShMJ42vRY" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/12/ec2-consistent-snapshot</feedburner:origLink></entry>

<entry>
    <title>Listing Recent Prices for EC2 Spot Instances</title>
    <link rel="alternate" type="text/html" href="http://feeds.alestic.com/~r/alestic/~3/g22cF2ruEzQ/ec2-spot-instance-prices" />
    <id>tag:alestic.com,2009://1.70</id>

    <published>2009-12-14T10:00:10Z</published>
    <updated>2009-12-14T11:01:08Z</updated>

    <summary>The new spot instances on EC2 are a great way to get some extra compute power at a price you can live with, especially if you are flexible on exactly when the instances run. On the other hand maybe you...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2spotinstances" label="EC2 spot instances" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="prices" label="prices" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="pricing" label="pricing" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="spotinstances" label="spot instances" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;The new &lt;a href="http://aws.amazon.com/ec2/spot-instances/"&gt;spot instances on EC2&lt;/a&gt; are a great way to get some extra compute power at a price you can live with, especially if you are flexible on exactly when the instances run.  On the other hand maybe you won&amp;#8217;t get the compute power if the spot instance price never drops to the max price you are willing to pay.&lt;/p&gt;

&lt;p&gt;The best way to approach auction type situations like this is often to simply list the maximum price you can afford.  Your instance(s) will get run if and when the spot instance price reaches that price and you will regularly get charged less depending on what other users are bidding for their instances.&lt;/p&gt;

&lt;p&gt;Though I don&amp;#8217;t recommend trying to chase the spot instance price around, it is natural to be curious about what others have been paying and whether or not you might have a chance to get in with your bid.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;ec2-describe-spot-price-history&lt;/code&gt; command lists the historical values of the spot instance price for all sizes and types of instances.  This is useful for studying fluctuations over time, but sometimes you&amp;#8217;ll just want to know what the latest spot instance price is, even though this is not necessarily the price you would get charged if you opened new spot instance requests.&lt;/p&gt;

&lt;p&gt;The following command shows the most recent spot instance price for each size of the Linux instances:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-describe-spot-price-history -d Linux/UNIX |
  sort -rk3 |
  perl -ane 'print "$F[1]\t$F[3]\n" unless $seen{$F[3]}++' |
  sort -n
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;To check the spot price in a different region, simply add an option like&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;--region us-west-1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;--region eu-west-1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As of the writing of this article, the prices returned for the us-east-1 region are as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;0.026   m1.small
0.05    c1.medium
0.11    m1.large
0.25    c1.xlarge
0.265   m1.xlarge
0.443   m2.2xlarge
0.997   m2.4xlarge
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The exact spot instance prices will vary significantly from these samples over time and likely even during the course of a day.  In fact, the spot instance price may occasionally exceed the on demand (standard) EC2 instance price.&lt;/p&gt;

&lt;p&gt;Who&amp;#8217;s going to be the first person to provide handy, real time, spot price history graphs by EC2 region, instance class (Linux/Windows), and instance type with correct X-axis date/time scaling?&lt;/p&gt;

&lt;p&gt;Good luck bidding!&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/g22cF2ruEzQ" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/12/ec2-spot-instance-prices</feedburner:origLink></entry>

<entry>
    <title>Increasing Root Disk Size of an "EBS Boot" AMI on EC2</title>
    <link rel="alternate" type="text/html" href="http://feeds.alestic.com/~r/alestic/~3/AEU2hnlsUoM/ec2-ebs-boot-resize" />
    <id>tag:alestic.com,2009://1.69</id>

    <published>2009-12-11T10:25:49Z</published>
    <updated>2009-12-12T02:41:57Z</updated>

    <summary>Amazon EC2’s new EBS Boot feature not only provides persistent root disks for instances, but also supports root disks larger than the previous limit of 10GB under S3 based AMIs. Since EBS boot AMIs are implemented by creating a snapshot,...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="disks" label="disks" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ebs" label="EBS" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ebsboot" label="EBS boot" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ext3" label="ext3" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="filesystems" label="filesystems" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="images" label="images" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="instances" label="instances" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="resize2fs" label="resize2fs" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="snapshots" label="snapshots" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="xfs" label="XFS" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;Amazon EC2&amp;#8217;s new &lt;a href="http://aws.amazon.com/about-aws/whats-new/2009/12/03/amazon-ec2-instances-now-can-boot-from-amazon-ebs/"&gt;EBS Boot&lt;/a&gt; feature not only provides persistent root disks for instances, but also supports root disks larger than the previous limit of 10GB under S3 based AMIs.&lt;/p&gt;

&lt;p&gt;Since EBS boot AMIs are implemented by creating a snapshot, the AMI publisher controls the default size of the root disk through the size of the snapshot.  There are a number of factors which go into deciding the default root disk size of an EBS boot AMI and some of them conflict.&lt;/p&gt;

&lt;p&gt;On the one hand, you want to give users enough free space to run their applications, but on the other hand, you don&amp;#8217;t want to increase the cost of running the instance too much.  EBS volumes run $0.10 to $0.11 per GB per month depending on the region, or about $10/month for 100GB and $100/month for 1TB.&lt;/p&gt;

&lt;p&gt;I suspect the answer to this problem might be for AMI publishers to provide a reasonable low default, perhaps 10GB as per the old standard or 15GB following in the footsteps of Amazon&amp;#8217;s first EBS Boot AMIs.  This would add $1.00 to $1.50 per month to running the instance which seems negligible for most purposes. &lt;em&gt;Note: There are also IO charges and charges for EBS snapshots, but those are more affected by usage and less by the size of the original volume.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For applications where the EBS boot AMI&amp;#8217;s default size is not sufficient, users can increase the root disk size at run time all the way up to 1 TB.  Here&amp;#8217;s a quick overview of how to do this.&lt;/p&gt;

&lt;h2&gt;Example&lt;/h2&gt;

&lt;p&gt;The following demonstrates how to run Amazon&amp;#8217;s &lt;code&gt;getting-started-with-ebs-boot&lt;/code&gt; AMI increasing the root disk from the default of 15GB up to 100GB.  &lt;/p&gt;

&lt;p&gt;Before we start, let&amp;#8217;s check to see the default size of the root disk in the target AMI and what the device name is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ ec2-describe-images ami-b232d0db
IMAGE   ami-b232d0db    amazon/getting-started-with-ebs-boot    amazon  available   public      i386    machine aki-94c527fd    ari-96c527ff        ebs
BLOCKDEVICEMAPPING  /dev/sda1       snap-a08912c9   15
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We can see the EBS snapshot id &lt;code&gt;snap-a08912c9&lt;/code&gt; and the fact that it is 15 GB attached to &lt;code&gt;/dev/sda1&lt;/code&gt;.  If we start an instance of this AMI it will have a 15 GB EBS volume as the root disk and we won&amp;#8217;t be able to change it once it&amp;#8217;s running.&lt;/p&gt;

&lt;p&gt;Now let&amp;#8217;s run the EBS boot AMI, but we&amp;#8217;ll override the default size, specifying 100 GB for the root disk device (&lt;code&gt;/dev/sda1&lt;/code&gt; as seen above):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-run-instances                       \
  --key KEYPAIR                         \
  --block-device-mapping /dev/sda1=:100 \
  ami-b232d0db
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If we check the EBS volume mapped to the new instance we&amp;#8217;ll see that it is 100GB, but when we ssh to the instance and check the root file system size we&amp;#8217;ll notice that it is only showing 15 GB:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              15G  1.6G   13G  12% /
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;There&amp;#8217;s one step left.  We need to resize the file system so that it fills up the entire 100 GB EBS volume.  Here&amp;#8217;s the magic command for ext3.  In my early tests it took 2-3 minutes to run:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ sudo resize2fs /dev/sda1
resize2fs 1.40.4 (31-Dec-2007)
Filesystem at /dev/sda1 is mounted on /; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 7
Performing an on-line resize of /dev/sda1 to 26214400 (4k) blocks.
The filesystem on /dev/sda1 is now 26214400 blocks long.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Finally, we can check to make sure that we&amp;#8217;re running on a bigger file system:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ df -h /
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              99G  1.6G   92G   2% /
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note: The output reflects &amp;#8220;99&amp;#8221; instead of &amp;#8220;100&amp;#8221; because of slight differences in how &lt;code&gt;df&lt;/code&gt; and EBS calculate &amp;#8220;GB&amp;#8221; (e.g., 1024 MB vs 1000 MB).&lt;/p&gt;

&lt;h2&gt;XFS&lt;/h2&gt;

&lt;p&gt;If it were possible to create an EBS boot AMI with an XFS root file system, then the resizing would be near instantaneous using commands like&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo apt-get update &amp;amp;&amp;amp; sudo apt-get install -y xfsprogs
sudo xfs_growfs /
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The Ubuntu kernels built for EC2 by Canonical have XFS support built in, so XFS based EBS boot AMIs might be possible.  This would also allow for more &lt;a href="http://alestic.com/2009/09/ec2-consistent-snapshot"&gt;consistent EBS snapshots&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Toolset&lt;/h2&gt;

&lt;p&gt;Make sure you are running the latest version of the &lt;code&gt;ec2-run-instances&lt;/code&gt; command.  The current version can be determined with the command&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-version
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;To use EBS boot features, the version should be at least 1.3-45772.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Updated 2009-12-11: Switch instructions to default us-east-1 since all regions now support this feature.&lt;/em&gt;&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/AEU2hnlsUoM" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/12/ec2-ebs-boot-resize</feedburner:origLink></entry>

<entry>
    <title>Ubuntu Karmic Desktop on EC2</title>
    <link rel="alternate" type="text/html" href="http://feeds.alestic.com/~r/alestic/~3/ECD8n9sCarg/ec2-karmic-desktop" />
    <id>tag:alestic.com,2009://1.68</id>

    <published>2009-11-16T10:42:41Z</published>
    <updated>2009-11-16T08:47:54Z</updated>

    <summary>As Thilo Maier pointed out in comments on my request for UDS input, I have been publishing both server and desktop AMIs for running Ubuntu on EC2 up through Jaunty, but the official Karmic AMIs on EC2 only support server...</summary>
    <author>
        <name>Eric Hammond</name>
        <uri>http://www.anvilon.com/</uri>
    </author>
    
        <category term="EC2" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PlanetUbuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Ubuntu" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="UbuntuCloud" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="desktop" label="desktop" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ec2" label="EC2" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="gnome" label="Gnome" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="karmic" label="Karmic" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="kde" label="KDE" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="nx" label="NX" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="runurl" label="runurl" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ubuntu" label="Ubuntu" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="userdata" label="user-data" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://alestic.com/">
        &lt;p&gt;As Thilo Maier pointed out in comments on my &lt;a href="http://alestic.com/2009/11/ec2-uds-lucid"&gt;request for UDS input&lt;/a&gt;, I have been publishing both server and desktop AMIs for running Ubuntu on EC2 up through Jaunty, but the official Karmic AMIs on EC2 only support server installations by default.&lt;/p&gt;

&lt;p&gt;Ubuntu makes it pretty easy to install the desktop software on a server, and NX from NoMachine makes it pretty easy to access that desktop remotely, with near real-time interactivity even over slowish connections.&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s a quick guide to setting this up, starting with an Ubuntu 9.10 Karmic AMI on Amazon EC2:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create a &lt;a href="http://alestic.com/2009/06/ec2-user-data-scripts"&gt;user-data script&lt;/a&gt; which installs &lt;a href="http://alestic.com/2009/08/runurl"&gt;runurl&lt;/a&gt; (not on Karmic AMIs by default) and then runs a simple desktop and NX server installation script.  Examine the &lt;a href="http://run.alestic.com/install/desktop"&gt;desktop&lt;/a&gt; script to see what it&amp;#8217;s doing to install the software.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cat &amp;lt;&amp;lt;EOM &amp;gt;install-desktop
#!/bin/bash -ex
wget -qO/usr/bin/runurl run.alestic.com/runurl
chmod 755 /usr/bin/runurl
runurl run.alestic.com/install/desktop
EOM
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start an instance on EC2 telling it to run the above user-data script on first boot.  The following example uses the current 32-bit Karmic server AMI.  Make sure you&amp;#8217;re using the &lt;a href="http://alestic.com/"&gt;latest AMI id&lt;/a&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-run-instances                   \
  --key YOURKEY                     \
  --user-data-file install-desktop  \
  ami-1515f67c
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Connect to the new instance and wait for it to complete the desktop software installation (when sshd is restarted).  This takes about 30 minutes on an m1.small instance and 10 minutes on a c1.medium instance.  Then generate and set a secure password for the &lt;code&gt;ubuntu&lt;/code&gt; user using copy/paste from the &lt;code&gt;pwgen&lt;/code&gt; output.  Save the secure password so you can enter it into the NX client later.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ssh -i YOURKEY.pem ubuntu@THEHOST
tail -f /var/log/syslog | egrep --line-buffer user-data:
pwgen -s 16 1
sudo passwd ubuntu
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;em&gt;If anybody knows how to use ssh keys with NX, I&amp;#8217;d love to do this instead of using passwords.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Back on your local system, install and run the NX client.  For computers not running Ubuntu, &lt;a href="http://www.nomachine.com/download.php"&gt;download the appropriate software from NoMachine&lt;/a&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;wget http://64.34.161.181/download/3.4.0/Linux/nxclient_3.4.0-5_i386.deb
sudo dpkg -i nxclient_3.4.0-5_i386.deb
/usr/NX/bin/nxclient --wizard &amp;amp;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Point the NX Client to the external hostname of your EC2 instance.  Enter the Login &amp;#8220;ubuntu&amp;#8221; and the Password from above. Choose the &amp;#8220;Gnome&amp;#8221; desktop.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If all goes well, you should have a complete and fresh Ubuntu desktop filling most of your screen, available for you to mess around with and then throw away.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ec2-terminate-instances INSTANCEID
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you want to have a persistent desktop with protection from crashes, you&amp;#8217;ll need to learn how to do things like &lt;a href="http://ec2ebs-mysql.notlong.com/"&gt;placing critical directories on EBS volumes&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you&amp;#8217;d like to run KDE on EC2, replace the package &amp;#8220;ubuntu-desktop&amp;#8221; with &amp;#8220;kubuntu-desktop&amp;#8221; in the installation script.&lt;/p&gt;

        

    &lt;img src="http://feeds.feedburner.com/~r/alestic/~4/ECD8n9sCarg" height="1" width="1"/&gt;</content>
<feedburner:origLink>http://alestic.com/2009/11/ec2-karmic-desktop</feedburner:origLink></entry>

</feed>
