CLICK HERE FOR PAGE-1
Step 15:
Let's unmount the filesystems which we mounted.
-
[root@nixhat]$ umount /mnt/centos5.5/proc
[root@nixhat]$ umount /mnt/centos5.5/sys
[root@nixhat]$ umount /mnt/centos5.5
Step 16:
For bundling the image we need amazon api tools. Let's download and install it.
-
[root@nixhat]$ cd /mnt
[root@nixhat]$ wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip
[root@nixhat]$ unzip ec2-api-tools-*.zip
[root@nixhat]$ cd ec2-api-tools-xxxxx
[root@nixhat]$ export EC2_HOME=`pwd`
[root@nixhat]$ export PATH=$EC2_HOME/bin:$PATH
Step 17:
Download AWS certificate and private key and store it in /mnt as cert.pem and key.pem
Lets bundle the image.
-
[root@nixhat]$ ec2-bundle-image –image /mnt/ami-centos5.5-32bit.img –prefix ami-centos5.5-32bit-base –cert /mnt/cert.pem –privatekey /mnt/key.pem –user <accountnumber> –destination /mnt –arch i386
Step 18:
Upload the image to S3. For that, create a bucket in S3 using your favourite S3 client.
-
[root@nixhat]$ ec2-upload-bundle –manifest /mnt/ami-centos5.5-32bit.manifest.xml –bucket <yourbucketname> –access-key <accesskey> –secret-key <secretkey>
Step 19:
Register your new AMI. When you register you have to set the default kernel as one which supports grub boot loader.
Amazon has published AKIs (amazon kernel images) that uses PVGRUB. PVGRUB selects the kernel to boot by reading /boot/grub/menu.lst from your image.
Each AKI type is available in all four regions:
US‐East‐1
aki‐4c7d9525 ec2‐public‐images/pv‐grub‐hd00‐V1.01‐i386.gz.manifest.xml
aki‐4e7d9527 ec2‐public‐images/pv‐grub‐hd00‐V1.01‐x86_64.gz.manifest.xml
aki‐407d9529 ec2‐public‐images/pv‐grub‐hd0‐V1.01‐i386.gz.manifest.xml
aki‐427d952b ec2‐public‐images/pv‐grub‐hd0‐V1.01‐x86_64.gz.manifest.xml
US‐West‐1
aki‐9da0f1d8 ec2‐public‐images‐us‐west‐1/pv‐grub‐hd00‐V1.01‐i386.gz.manifest.xml
aki‐9fa0f1da ec2‐public‐images‐us‐west‐1/pv‐grub‐hd00‐V1.01‐x86_64.gz.manifest.xml
aki‐99a0f1dc ec2‐public‐images‐us‐west‐1/pv‐grub‐hd0‐V1.01‐i386.gz.manifest.xml
aki‐9ba0f1de ec2‐public‐images‐us‐west‐1/pv‐grub‐hd0‐V1.01‐x86_64.gz.manifest.xml
EU‐West‐1
aki‐47eec433 ec2‐public‐images‐eu/pv‐grub‐hd00‐V1.01‐i386.gz.manifest.xml
aki‐41eec435 ec2‐public‐images‐eu/pv‐grub‐hd00‐V1.01‐x86_64.gz.manifest.xml
aki‐4deec439 ec2‐public‐images‐eu/pv‐grub‐hd0‐V1.01‐i386.gz.manifest.xml
aki‐4feec43b ec2‐public‐images‐eu/pv‐grub‐hd0‐V1.01‐x86_64.gz.manifest.xml
Now lets register the ami.
ec2-register -C <certificate_file> -K <private_keyfile> -n <name> -d "<description>" –kernel <kerneltype> <bucket>/<aminame-manifest.xml>
-
[root@nixhat]$ ec2-register -C /mnt/cert.pem -K /mnt/key.pem -n CentOS5.5-32bit -d "CentOS 5.5 32bit" –kernel aki‐4c7d9525 centos55base/ami-centos5.5-32bit.manifest.xml
That's it. Now you can launch your own custom AMI with Centos 5.5 and its xen kernel.