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
ec2-register your-s3-bucket/yourImageName.manifest.xml
- And you are done!
1 comment
1 ping
raghu says:
January 18, 2010 at 8:29 am (UTC -4)
Nice blog..
thanks
-raghu
Forking ami-5394733a « LeLand says:
March 30, 2010 at 5:54 pm (UTC -4)
[...] can then follow these steps to bundle your customized AMI. Enjoy Categories: Amazon EC2 Tags: fork Comments (0) [...]