{"id":823,"date":"2012-08-06T22:11:32","date_gmt":"2012-08-07T05:11:32","guid":{"rendered":"http:\/\/yan.lalife.net\/?p=823"},"modified":"2026-01-20T05:08:02","modified_gmt":"2026-01-20T05:08:02","slug":"create-my-own-aws-ami","status":"publish","type":"post","link":"http:\/\/www.lalife.net\/?p=823","title":{"rendered":"Create my own AWS AMI"},"content":{"rendered":"<p>Followed this very detailed instruction to create my own CentOS5 AWS AMI image<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"sfMekHW4Gu\"><p><a href=\"https:\/\/philchen.com\/2009\/02\/14\/how-to-create-an-amazon-elastic-compute-cloud-ec2-machine-image-ami\/\">How to create an Amazon Elastic Compute Cloud EC2 Machine Image (AMI)<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;How to create an Amazon Elastic Compute Cloud EC2 Machine Image (AMI)&#8221; &#8212; Phil Chen\" src=\"https:\/\/philchen.com\/2009\/02\/14\/how-to-create-an-amazon-elastic-compute-cloud-ec2-machine-image-ami\/embed\/#?secret=BZRIXgsnYV#?secret=sfMekHW4Gu\" data-secret=\"sfMekHW4Gu\" width=\"584\" height=\"329\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<p>Every thing went all right except the problem came when booting the image&#8230;it doesn&#8217;t boot.<\/p>\n<p>It seems that the kernel 2.6.16 is too old, so download 2.6.18 from Amazon Dev forum.<br \/>\nRebundled and registered the image with new kernel but still it doesn&#8217;t boot&#8230;.<br \/>\nThe 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.<\/p>\n<p>Using the following way to convert the instance-store backed image to EBS backed image.<br \/>\nBring up a EBS volume and attach to this server,<br \/>\n# mkdir \/newos &#038;&#038; mount \/dev\/sdf \/newos<br \/>\n# rsync -avHx \/ \/newos<br \/>\n# rsync -avHx \/dev \/newos<br \/>\n# sync;sync;sync;sync &#038;&#038; umount \/newos<br \/>\nThen create a snapshot of the volume.<\/p>\n<p>Use command line or aws admin console to register AMI<br \/>\nRegister the AMI<br \/>\n# ec2-register -a x86_64 &#8211;block-device-mapping \/dev\/sda1=snap-2715c442::false &#8211;name mycentos5ebs_2012 &#8211;kernel aki-xxxxxx &#8211;ramdisk ari-xxxxxx -K pk-xxxxxxxxxxxxx.pem -C cert-xxxxxxxxxxxx.pem &#8211;region us-west-1<br \/>\nIMAGE\tami-xxxxxx<br \/>\n(use the same aki-xxxxx and ari-xxxxxx as the original server used for creating image)<\/p>\n<p>Another issue:<br \/>\nWhen running &#8220;yum update&#8221;, it shows error message for corrupted rpm db.<br \/>\nIt seems that rpm db is using Berkely DB and after tried to fix the db by<br \/>\nrm -f \/var\/lib\/rpm\/__db*<br \/>\nrpm &#8211;rebuilddb<br \/>\nIt still shows error &#8220;cannot open Packages index using db3&#8221;<\/p>\n<p>So initial the db by<br \/>\nrpm &#8211;initdb<br \/>\nthen install the Base yum packages again<br \/>\nyum -y groupinstall Base<\/p>\n<p>References<br \/>\nhttp:\/\/www.howtoforge.com\/kernel_compilation_fedora<br \/>\nhttp:\/\/www.cyberciti.biz\/tips\/compiling-linux-kernel-26.html<br \/>\nhttp:\/\/aws.typepad.com\/aws\/2010\/07\/use-your-own-kernel-with-amazon-ec2.html<br \/>\nhttp:\/\/docs.amazonwebservices.com\/AWSEC2\/latest\/UserGuide\/UserProvidedkernels.html<br \/>\nhttp:\/\/www.ibm.com\/developerworks\/linux\/library\/l-linuxboot\/<br \/>\nhttp:\/\/amazonaws.michael&#8211;martinez.com\/<br \/>\nhttp:\/\/www.ioncannon.net\/system-administration\/1205\/installing-cent-os-5-5-on-ec2-with-the-cent-os-5-5-kernel\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230;it doesn&#8217;t boot. &hellip; <a href=\"http:\/\/www.lalife.net\/?p=823\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"class_list":["post-823","post","type-post","status-publish","format-standard","hentry","category-aws-ec2-cloud"],"_links":{"self":[{"href":"http:\/\/www.lalife.net\/index.php?rest_route=\/wp\/v2\/posts\/823","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.lalife.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.lalife.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.lalife.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.lalife.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=823"}],"version-history":[{"count":1,"href":"http:\/\/www.lalife.net\/index.php?rest_route=\/wp\/v2\/posts\/823\/revisions"}],"predecessor-version":[{"id":1865,"href":"http:\/\/www.lalife.net\/index.php?rest_route=\/wp\/v2\/posts\/823\/revisions\/1865"}],"wp:attachment":[{"href":"http:\/\/www.lalife.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.lalife.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=823"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.lalife.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}