When I started experimenting with Amazon's ec2 I ran into the issue that I wanted to test on the cheapest instance type possible, which is t1.micro but does not support instance-store AMI images. Since a lot of prepacked images are available only as instance-store images, it's a lot easier to start from one of those than to roll your own from scratch.
To convert an instance-store image into an EBS backed AMI you need to perform the following steps:
Boot up an instance-store AMI
ec2run ami-xxx
create a volume big enough to hold your root partition
ec2addvol -s X -z <zone>
The zone has to be the same as the current intance
attach the volume to the instance
ec2attvol vol-xxx -i <intance> -d /dev/sdd
create a file system
log into your instance and
mkfs.ext3 /dev/sdd
mount the disk
mount /dev/sdd /ebs
copy the root partition over to the volume
Install cpipe if unavailable
tar cpS / | cpipe -vt -b 1024 | tar xpS -C /ebs
detach the volume
ec2detvol vol-xxx
create a snapshot
ec2addsnap vol-xxx -d "Some meaningful description"
check with ec2dsnap
if the snapshot has completed
register your new ami with EBS backing
ec2reg --kernel aki-xxx --ramdisk ari-xxx -b "/dev/sda1=snap-xxx:<size>:true" -d "Debian Lenny/5.0 2 GiB EBS i386" --root-device-name "/dev/sda1" -n "deb_lenny_ebs_i386"
On a side note: the true
at the end of the block device mapping above means that the ebs volume is automatically deleted after the instance terminates (not after it is stopped).
After you performed all the steps above you can delete the ebs volume. Whenever you fire up one of your new ebs backed instances, this will create a new ebs root device for it.