云计算 频道

amazon aws 使用笔记

三、定制自己的AMI

  1、以amazon上的AMI为基础创建:

  (1)选择一个AMI,启动一个Instance

  (2)安装jdk1.5

  (3)安装ruby
yum install ruby

  (4)安装ami-tools
下载:http://developer.amazonwebservices.com/connect/entry.jspa?externalID=368
安装:rpm -i ec2-ami-tools-x.x-xxxx.i386.rpm

  (5)上传private key和cert

  (6)打包现在的系统

ec2-bundle-vol -k /opt/ec2/pk-6FW5MJGDE7EHO9WFDZVOTDNHBMM5MRPA.pem -c /opt/ec2/cert-6FW5MJGDE7EHO9WFDZVOTDNHBMM5MRPA.pem -u 911139294232 --debug
说明:-u是你的账号去掉“-”

  执行到一半时会umount /mnt/img-mnt,确保没有程序在使用该目录。常见的,查看是否有终端登在该目录中。

  打包好的文件存储在/tmp中

  (7)上传打包好的系统到S3上
cd /tmp
命令:ec2-upload-bundle -b <bucket-name> -m image.manifest.xml -a <access_key> -s <secret_key>
如:ec2-upload-bundle -b wamo-uranus -m image.manifest.xml -a 1DQ7TN5665Z7TVDNN687 -s jUop8Yv8Ze6J0xi9qNrI+UbIbPKYrZQFt0pn6Va
说明:
bucket:在S3上的一个存储目录。这个bucket name需要保证全局唯一性。

  (8)注册这个AMI
To launch the AMI, you must register it. For more information, see ec2-register
http://docs.amazonwebservices.com/AWSEC2/latest/DeveloperGuide/index.html?CLTRG-register.html
如:ec2-register wamo-uranus/image.manifest.xml

  2、从vmware创建一个AMI
http://blog.chinaunix.net/u/32831/showart_1839873.html
另外,kernel需要是xen的内核:The current hardware does NOT support hardware virtualization, so you need to build for Xen。In general, building for Xen, even on virtualizing hardware, can improve performance.

  更多,可以查看我的另一篇文章:
http://blog.chinaunix.net/u/32831/showart_1886169.html

  注:从本地上传做好的image到s3上时只需要上传 image.part.00 到 image.part.98和image.manifest.xml文件即可,大概1G左右,最大的那个3G左右的image文件不需要上传。

  注:我按照上面的方法做了一个AMI,启动时出现了错误
FATAL: Could not load /lib/modules/2.6.16-xenU/modules.dep: No such file or directory 。

  原因,查看下面的文章:
http://developer.amazonwebservices.com/connect/message.jspa?messageID=112316

0
相关文章