Howto bundle an EC2 Amazon image (not EBS)
Ok, I’m sure that you build an image (not EBS) on Amazon EC2 and after all you wanted to save it…how?
On the Ami in Amazon EC2 lets make the following.
1- lets going to install Amazon EC2 API:
perl -pi -e ‘s%(universe)$%$1 multiverse%’ /etc/apt/sources.list
apt-get install ec2-api-tools ec2-ami-tools
2- We need to set some environment variables, this variables are pointing to a directory where the certeficates are stored, we need the key that you downloaded to access your images, and the x.509 certificate.
3.- Bundling the AMI: This step will create an image and break it into different part 10MB each and encrypt them.(note:if it is an AMD64 system replace i386 by x86_64)
ec2-bundle-vol -d /mnt -k $EC2_PRIVATE_KEY -c $EC2_CERT -u $EC2_ACCNO -r i386
4- Create a bucket on S3: In this bucket our newly created AMI will be saved
5- Upload AMI to S3:
ec2-upload-bundle -b YOUR-S3-BUCKET -m /mnt/image.manifest.xml -a $ACCESS_KEY -s $SECRET_KEY
6- Register the AMI: Your image must be registered with Amazon EC2, so Amazon can locate it and run instances based on it. In this process your newly created AMI will get unique AMI Id:
ec2-register –K $EC2_PRIVATE_KEY –C $EC2_CERT YOUR-S3-BUCKET/image.manifest.xml –region eu-west-1