Everytime I need to bundle image in Amazon server, I need to google on how to do the bundling. I could not remember the steps. :X so I think it’s better for me to write it down here for my own reference or maybe other can find it useful to do it.
I wrote this bundling guide with the assumption you have your AWS account created from aws.amazon.com or you can read amazon doco on getting started with AWS: http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/Welcome.html. You also need your certificate, private key as well as your keypair ready to do this bundling.
The instruction below is for bundling Ubuntu/Linux AMI:
- Preparation: ssh into your current AMI instances that you want to bundle using your keypair:
ssh -i yourKeypair root@youriInstanceAddress
- Copy your private key and your certificate to the /mnt of instance that you are going to bundle (/mnt drive will not be bundled):
scp -i yourKeypair pk-yourpkkey.pem cert-yourcert.pem root@yourInstanceAddress:/mnt
- Install ec2 tools your Instance does not have ec2-tool:
sudo apt-get install ec2-api-tools
Note: Instruction can be found at: http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/setting-up-your-tools.html
- Bundle your image (this will take awhile):
ec2-bundle-vol -d /mnt -k /mnt/pk-yourpkkey.pem -c /mnt/cert-yourcert.pem -u AIDADH4IGTRXXKCD -r i386 -p yourImageName
- Check your bundle:
ls -l /mnt/youImageName.*
- Uploading your image
ec2-upload-bundle -b your-s3-bucket -m /mnt/yourImageName.manifest.xml -a your-aws-access-key-id -s your-aws-secret-access-key
- Register your AMI
- And you are done!