Amazon EC2 provides the instance with additional local storage by way of a disk drive on /dev/sda2.
In addition, swap space is provided on /dev/sda3. To ensure both these are mounted at system start up
time, add the following lines to /mnt/ec2-fs/etc/fstab:
/dev/sda2 /mnt ext3 defaults 1 2
/dev/sda3 swap swap defaults 0 0
Configure Additional Services
Finally, make sure that all of your required services will be started at system start up time by allocating
them to the appropriate system run levels. To enable the service my-service on multi-user and
networked run levels, for example, execute:
# chroot /mnt/ec2-fs /bin/sh
# chkconfig --level 345 my-service on
# exit
Unmount the Loopback File
Your new installation has now been successfully installed and configured to operate in the Amazon EC2
environment. You may now unmount the image:
# umount /mnt/ec2-fs/proc
# umount -d /mnt/ec2-fs
Amazon EC2
Developer Guide
9
Bundling an AMI
A root file system image needs to be bundled as an AMI in order to be used with the Amazon EC2
service. The bundling process first compresses the image to minimize bandwidth usage and storage
requirements. The compressed image is then encrypted and signed to ensure confidentiality of the data,
and authentication against the creator. The encrypted image is finally split into manageable parts for
upload. A manifest file is created containing a list of the image parts with their checksums. This chapter
provides an overview of the AMI tools that automate this process and some examples of their use.
The AMI tools are three command-line utilities:
1. ec2-bundle-image bundles an existing AMI
2. ec2-bundle-vol creates an AMI from an existing machine or installed volume
3. ec2-upload-bundle uploads a bundled AMI to S3 storage
Installing the AMI Tools
The AMI tools are packaged as an RPM suitable for running on Fedora Core 3/4 with Ruby 1.8.2 (or
greater) installed. On Fedora Core 4 Ruby can be installed by following the steps below. You will need
root privileges to install the software. You can find the AMI tools RPM at .
First install Ruby using the yum package manager.
# yum install ruby
Install the ec2-common-ruby RPM which contains library functions that the AMI tools depend on. The
x's represent the major version, minor version and build number of the RPMs.
# rpm -i ec2-common-ruby-x.x-xxxx.i386.rpm
Install the AMI tools RPM.
# rpm -i ec2-ami-tools-x.x-xxxx.i386.rpm
Installation Issues
The AMI tools libraries install under /usr/lib/site_ruby. Ruby should pick up this path
automatically, but if you see a load error when running one of the AMI utilities, it may be because Ruby
isn't looking there. To fix this, add /usr/lib/site_ruby to Ruby's library path, which is set in the
RUBYLIB environment variable.
Documentation
The manual describing the operation of each utility can be displayed by invoking it with the --manual
parameter. For example:
# ec2-bundle-image --manual
Invoking a utility with the --help parameter displays a summary and list of command line parameters.
For example:
# ec2-bundle-image --help
Amazon EC2
Developer Guide
10
Previous Page Next Page