Creating and Bundling AMIs
Amazon EC2 allows you to set up and configure everything about your instances from your operating
system up to your applications. An Amazon Machine Image (AMI) is simply a packaged-up copy of
your root file system. An AMI contains all the necessary bits to set up and boot an Amazon EC2
instance. Your AMIs are your unit of deployment. You might have just one AMI or you might compose
your system out of several building block AMIs (e.g., webservers, appservers, and databases).
This section details how to build your own AMIs and how to store them in Amazon S3. In addition, it
covers booting existing images, and bundling those (after making any required changes). Re-bundling
modified versions of existing AMIs provides an easy way to build up a range of different machine
images from a pool of existing base images. Amazon EC2 provides base AMIs to get you started.
Amazon EC2
Developer Guide
Creating an AMI
There are several techniques for creating an AMI offering a mix of ease of use and detailed
customization levels. The easiest method involves starting from an existing public AMI and modifying it
according to your requirements, as described in the section called “Starting with an Existing AMI” .
Another approach is to build a fresh installation either on a stand-alone machine or on an empty file
system mounted by loopback. This essentially entails building an operating system installation from
scratch and is described in the section called “Creating via a Loopback File” .
Once the installation package has been built to your satisfaction it needs to be bundled and uploaded to
Amazon S3 as described in the section called “Bundling an AMI” .
Starting with an Existing AMI
This is the quickest and easiest of the methods to get a new working AMI. Start with an existing public
AMI or one of your own. You can then modify that as you see fit and subsequently create a new AMI
with the ec2-bundle-vol utility, as decribed later in the section called “Bundling an AMI” .
Select an AMI
The first step is to locate an AMI that contains the packages and services that you require. This can be
one of your own AMIs or one of the public AMIs provided by Amazon EC2. Use ec2-describe-images
to get a list of available AMIs, as is shown below, then select one of the listed AMIs and note its AMI
ID, e.g. ami-61a54008:
PROMPT> ec2-describe-images
IMAGE ami-60a54009 ec2-public-images/base-fc4-apache.manifest 475219833042
available public
IMAGE ami-61a54028 <your-s3-bucket>/image.manifest 495219933132 available
IMAGE ami-61a54008 ec2-public-images/getting-started.manifest 475219833042
available public
IMAGE ami-6ea54007 ec2-public-images/base-fc3-mysql.manifest 475219833042
available public
Generate a Keypair
This step is only required if you've selected one of the public AMIs provided by Amazon EC2. A
public/private keypair must be created to ensure that you, and only you, have access to the instances that
you launch.
PROMPT> ec2-create-keypair gsg-keypair
KEYPAIR gsg-keypair
Amazon EC2
Developer Guide
Previous Page Next Page