Ubuntu and Debian AMIs for Amazon EC2

To view Ubuntu and Debian AMIs available for Amazon EC2:
Click on a tab above to select an Amazon EC2 region.



As Scott Moser announced, Canonical has released updated AMIs (Amazon Machine Images) for running Ubuntu 10.04 Lucid, Ubuntu 9.10 Karmic, and Ubuntu 8.04 Hardy on Amazon EC2.

The table at the top of Alestic.com has been updated to reflect the new AMI ids. In fact, I have automated this table so that it will update itself without manual intervention whenever new AMIs are released by Canonical, thanks to their AMI query API.

If you’re interested in automatically retrieving AMI ids for your own uses, here’s a sample URL for the released AMI ids for Ubuntu 10.04 Lucid (server) in an easy to parse format:

http://uec-images.ubuntu.com/query/lucid/server/released.current.txt

Other releases can be retrieved from similar URLs, or you can traverse the available results starting at the root:

http://uec-images.ubuntu.com/query/

You can get pointers to the daily AMI builds through this API, but I recommend sticking to the “released.current” lists for the best tested and most stable AMIs. These are the AMI ids that are listed in the table at the top of Alestic.com for easy browsing, along with the legacy AMIs which I published as “Alestic” for older releases not supported by Canonical.

Alestic.com Sponsorship

| 0 Comments | 0 TrackBacks | Bookmark and Share

A quick but heartfelt note of thanks to Ben Cherian at ServiceCloud, a long term supporter and faithful sponsor of Alestic.com (2 years!). Ben started sponsoring this site, supporting the public Ubuntu AWS/EC2 work I performed, back when this was just a one page site listing the Ubuntu AMI ids on EC2. Alestic.com has multiplied many times in content and organic web traffic over these two years.

Alestic.com is now open to new sponsors. If your company is interested in getting brand exposure at the top of every page on this site dedicated to running Ubuntu on Amazon EC2, please drop me an email.

I like to partner with companies like ServiceCloud and RightScale where the service or product matches the highly targeted reader audience of Alestic.com: folks using or planning to use AWS/EC2 cloud technologies.

BTW, if you are looking for a CIO, consider getting in touch with Ben Cherian who is coming available for new opportunities.

Amazon EC2 has been experiencing some power issues in a portion of one of their many data centers. Even though the relative percentage of people affected might be small, when you have as many customers as AWS does, a small fraction can still be a large absolute number of customers who are affected.

Naturally, some customers will be upset about not having access to their systems, but in the time it takes to write a complaint, you might be able to move your server to new hardware within EC2 and go on with your business

First, lets assume that you are running an EBS boot instance. If you didn’t think they were the way to go before reading this article, I expect to convince you with this one example (and there are a number of other benefits).

Setup

For this demo, I’m going to start an instance. In your situation this instance represents the currently running server that you are depending on and which has valuable software, configuration, and perhaps data on its EBS volume(s). I’m also going to drop a note on the EBS root disk on my running instance so that I know it is the one I wanted to preserve. Again, this is just setting things up for the demo:

# SKIP THIS ENTIRE SECTION IF YOU ALREADY HAVE AN INSTANCE RUNNING
keypair=YOURKEYPAIR
sshkey=.ssh/$keypair.pem # or wherever you keep it
region=us-west-1 # pick your region
zone=${region}a # pick your availability zone
type=m1.small # pick your size
amiid=ami-cb97c68e # Ubuntu 10.04 Lucid, 32-bit, EBS boot in that region
oldinstanceid=$(ec2-run-instances   --key $keypair   --region $region   --availability-zone $zone   --instance-type $type   $amiid |
  egrep ^INSTANCE | cut -f2)
echo "instanceid=$oldinstanceid"

while host=$(ec2-describe-instances --region $region "$oldinstanceid" | 
  egrep ^INSTANCE | cut -f4) && test -z $host; do echo -n .; sleep 1; done
echo host=$host

echo "save the volume" | ssh -i $sshkey ubuntu@$host tee README.txt

Moving to a New Instance

Now, we pretend that the above created instance has failed in some way and we can no longer access it. Here’s how we get our server running on a new instance:

  1. If you can, stop the old instance. This increases your chance of keeping the file system consistent on the EBS volume. If the instance has really failed and this step does not work, then skip it.

    ec2-stop-instances --region $region $oldinstanceid
    
  2. Run a new instance with the same startup parameters as your old instance.

    newinstanceid=$(ec2-run-instances   --key $keypair   --region $region   --availability-zone $zone   --instance-type $type   $amiid |
      egrep ^INSTANCE | cut -f2)
    echo "newinstanceid=$newinstanceid"
    
  3. Wait until the new instance is running and then stop (not terminate) the new instance and detach the EBS boot volume from it. Delete the volume as it has nothing of importance, having just been created.

    ec2-stop-instances --region $region $newinstanceid
    newebsroot=$(ec2-describe-instances --region $region $newinstanceid |
      grep ^BLOCKDEVICE | grep /dev/sda1 | cut -f3)
    ec2-detach-volume --force --region $region $newebsroot
    ec2-delete-volume --region $region $newebsroot
    
  4. Detach the old (valuable) EBS root volume from the old (broken) instance.

    oldebsroot=$(ec2-describe-instances --region $region $oldinstanceid |
      grep ^BLOCKDEVICE | grep /dev/sda1 | cut -f3)
    ec2-detach-volume --force --region $region $oldebsroot
    
  5. Attach the old (valuable) EBS root volume to the new (stopped) instance.

    ec2-attach-volume   --region $region   -d /dev/sda1   -i $newinstanceid   $oldebsroot
    

    If you had multiple EBS volumes attached to the old instance, you would move each one over in a similar manner.

  6. Restart the new instance which is now going to boot with the original volume.

    ec2-start-instances --region $region $newinstanceid
    

Voila! You have moved your server from an old, perhaps broken instance to new (or at least different) hardware keeping the same file system, and it took only a few minutes! If you’d like, ssh to the new instance and make sure that your valuable information is still there.

If you had an Elastic IP address associated with the old instance, you would move it to the new instance.

Cleanup

You may terminate the old instance if you are comfortable that you won’t need it any more. If you were following this demo as an exercise, you should also terminate the new instance. Since you manually attached the old volume to the new instance yourself, it will not be deleted automatically when the instance is terminated. You can modify the instance attributes to change the delete-on-termination flag for the volume or simply delete it manually.

# BEWARE! Don't copy these blindly, but think about what you should do
ec2-terminate-instances --region $region $oldinstanceid
ec2-terminate-instances --region $region $newinstanceid
ec2-delete-volume --region $region $oldebsroot

Tips

This above process can also be used when your instance is running fine, but you want to move to a different instance type (size) of the same architecture. For example, you could move from m1.small up to c1.medium, or from m2.4xlarge down to c1.xlarge. Update: I wasn’t thinking clearly when I wrote that last sentence. It is possible to change the instance type much more easily: Simply stop the instance, use ec2-modify-instance-attributes, and start it up again.

You can also resize the root disk of a running EC2 instance using the same basic principle of swapping out an EBS root volume on a running instance.

On Friday evening (2 days ago) I and a number of other high octane LA individuals came to LA StartupWeekend to participate in the process of building the beginning of a startup in 2 days. The group of eighty participants divided up organically by interest into about ten different ideas which had been pitched that very evening.

I ended up in a great team of 9 developers, designers, and product folks who were all interested in building the idea I proposed:

Connect individuals carrying cell phone cameras with people who want timely photographs at a particular location.

Less than 48 hours later, we launched the prototype which you can check out now at:

http://CrowdPhoto.net

And, we had a lot of fun in the process.

I mention this on the Alestic.com blog because our team used a number of cool technologies including:

  • Ubuntu 10.04 Lucid (released one day before we started this project)
  • Amazon EC2
  • Amazon SimpleDB (we decided to jump on the “NoSQL” buzzword bandwagon)
  • Amazon S3 (storage of uploaded photos)
  • Amazon CloudFront (CDN to serve the photos)
  • Perl 5.10
  • Mason (templating)
  • Apache (of course)
  • HTML, CSS3, JavaScript
  • Postfix (automatic processing of incoming photo emails)

Not shown on the site is the fact that two of the developers on the team learned Android development and built an integrated Android application which integrates with the CrowdPhoto.net service. In two days.

We also have prototype integration with Twitter. Feel free to follow us at:

@crowdphoto

Challenges we ran into and resolved included:

  • Our first AWS account took a long time to get approved for SimpleDB. Solution: We used SimpleDB from another AWS account (different than the one running the EC2 instance).

  • We quickly ran into the EC2 email sending limit just with cron job output and emails from our revision control system. Solution: relay email through one of our personal servers on a non-standard port.

  • We found that some SimpleDB requests had too high a latency to run a large number sequentially: Solution: make the requests in parallel (not yet implemented).

Ubuntu 10.04 Lucid worked like a charm.

Take the prototype service for a spin and let us know what you think. Do you think that this type of application has potential? What would you use it for?

Feel free to be harsh on what you see. We are. But, remember that this was built in less than 2 days from concept, to design, to building development infrastructure, to implementation. This is a fun prototyping project.

We don’t know if there is going to be a future for this project as we all go back to our separate real jobs on Monday, but some of us think there might be something really cool here. Give us your ideas.

[Update 2010-05-03: Added images]

Amazon EC2 just launched the Asia Pacific region with data centers in Singapore.

The standard Ubuntu and Debian AMIs (Amazon Machine Images) from Canonical and Alestic are already available in this new region. I have listed the new AMI ids in the table at the top of Alestic.com.

To see the AMIs, simply click on the ap-southeast-1 tab in the table at the top.

If you’re just getting into using Ubuntu on Amazon EC2, consider joining the EC2 Ubuntu group for community support.

Stay Updated

Subscribe with email address:
 Subscribe with a reader
Join the EC2 Ubuntu Google Group
Follow Eric Hammond on Twitter

More Entries

Ubuntu 10.04 Lucid Released for Amazon EC2
Ubuntu 10.04 Lucid was released on Amazon EC2 right on schedule today along with the rest of the normal Ubuntu…
Upgrading Servers to Ubuntu 10.04 Lucid on Amazon EC2
Ubuntu 10.04 Lucid is expected to be released this Thursday (April 29, 2010). This is the first LTS (long term…
Identifying When a New EBS Volume Has Completed Initialization From an EBS Snapshot
On Amazon EC2, you can create a new EBS volume from an EBS snapshot using a command like ec2-create-volume --availability-zone…
New releases of Ubuntu and Debian Images for Amazon EC2 (20100319)
Note: I do not recommend that new users start with these AMIs. These AMIs run with older versions of Amazon’s…
SCALE 8x Talk Notes: EC2 Beginners Workshop
At SCALE 8x (Southern California Linux Expo, Feb 2010) I did a walkthrough demonstrating how to use the AWS console…
The BitSource Interview of Eric Hammond (SCALE, EC2)
Matthew Sacks, of The BitSource, made the mistake of asking me some questions about Amazon EC2, so I rambled on…
Resizing the Root Disk on a Running EBS Boot EC2 Instance
In a previous article I described how to run an EBS boot AMI with a larger root disk size than…
New Ubuntu 8.04.3 Hardy AMIs for Amazon EC2
Scott Moser (Canonical) built and released new Ubuntu 8.04.3 LTS Hardy images and AMIs for Amazon EC2. I also published…
Southern California Linux Expo - Februrary 19-21, 2010 at the Westin LAX
The 8th Southern California Linux Expo (aka SCaLE 8x) is a community organized, non-profit event. Those words and the…
Public EBS Boot AMIs for Ubuntu on Amazon EC2
If you’ve been following along, you probably know that I have been recommending that folks using EC2 switch to the…
How to Report Bugs with Ubuntu on Amazon EC2: ubuntu-bug
The official Ubuntu AMIs published by Canonical for EC2 starting in October have proven to be solid and production worthy.…
Three Ways to Protect EC2 Instances from Accidental Termination and Loss of Data
Here are a few little-publicized benefits that were launched with Amazon EC2’s new EBS boot instances: You can lock them…
Building EBS Boot AMIs Using Canonical's Downloadable EC2 Images
In the last article, I described how to use the vmbuilder software to build an EBS boot AMI from scratch…
Building EBS Boot and S3 Based AMIs for EC2 with Ubuntu vmbuilder
Here’s my current recipe for how to build an Ubuntu 9.10 Karmic AMI, either the new EBS boot or the…
Call for testers (building EBS boot AMIs with Ubuntu vmbuilder)
I’m polishing up an article about how to build images from scratch with Ubuntu vmbuilder, both for S3 based AMIs…
ec2-consistent-snapshot release 0.1-9
Thanks to everybody who submitted bug reports and feature requests for ec2-consistent-snapshot, software which can be used to create consistent…
Listing Recent Prices for EC2 Spot Instances
The new spot instances on EC2 are a great way to get some extra compute power at a price you…
Increasing Root Disk Size of an "EBS Boot" AMI on EC2
Amazon EC2’s new EBS Boot feature not only provides persistent root disks for instances, but also supports root disks larger…
Ubuntu Karmic Desktop on EC2
As Thilo Maier pointed out in comments on my request for UDS input, I have been publishing both server and…
Ubuntu Developer Summit - EC2 Lucid
For the last year I have been working with Canonical and the Ubuntu server team, helping to migrate over to…