Followed this very detailed instruction to create my own CentOS5 AWS AMI image
How to create an Amazon Elastic Compute Cloud EC2 Machine Image (AMI)
Every thing went all right except the problem came when booting the image…it doesn’t boot.
It seems that the kernel 2.6.16 is too old, so download 2.6.18 from Amazon Dev forum.
Rebundled and registered the image with new kernel but still it doesn’t boot….
The next thing I tried is to specify the kernel ID and RAM ID as the same ones which is used to bundle/upload AMI images, when bringing up the instance. It booted this time.
Using the following way to convert the instance-store backed image to EBS backed image.
Bring up a EBS volume and attach to this server,
# mkdir /newos && mount /dev/sdf /newos
# rsync -avHx / /newos
# rsync -avHx /dev /newos
# sync;sync;sync;sync && umount /newos
Then create a snapshot of the volume.
Use command line or aws admin console to register AMI
Register the AMI
# ec2-register -a x86_64 –block-device-mapping /dev/sda1=snap-2715c442::false –name mycentos5ebs_2012 –kernel aki-xxxxxx –ramdisk ari-xxxxxx -K pk-xxxxxxxxxxxxx.pem -C cert-xxxxxxxxxxxx.pem –region us-west-1
IMAGE ami-xxxxxx
(use the same aki-xxxxx and ari-xxxxxx as the original server used for creating image)
Another issue:
When running “yum update”, it shows error message for corrupted rpm db.
It seems that rpm db is using Berkely DB and after tried to fix the db by
rm -f /var/lib/rpm/__db*
rpm –rebuilddb
It still shows error “cannot open Packages index using db3”
So initial the db by
rpm –initdb
then install the Base yum packages again
yum -y groupinstall Base
References
http://www.howtoforge.com/kernel_compilation_fedora
http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html
http://aws.typepad.com/aws/2010/07/use-your-own-kernel-with-amazon-ec2.html
http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html
http://www.ibm.com/developerworks/linux/library/l-linuxboot/
http://amazonaws.michael–martinez.com/
Installing Cent OS 5.5 on EC2 with the Cent OS 5.5 Kernel