Tuesday, July 14, 2009

bundling instances i.e. creating your own aws images

based on
http://blogs.sun.com/branajam/entry/aws_experience_part_6_creating

Supposing you're accessing your image using putty, you're clued up on .pem files, you can push the .pem files to an ftp server and pull them to your aws instance or whatever route you choose...

1. copy .pem files to /mnt
(my private key).pem
(my private cert).pem

2. make a note of your aws account number - this is a very convoluted area as there as all sorts of number flying about, anyway the account number appears on your aws accounts "Personal Information" link under "Your Account" and should look like

Account Number XXXX-XXXX-XXXX

3. create a subdirectory such as /mnt/ami

4. run

ec2-bundle-vol -d /mnt/ami -k /mnt/(my private key).pem -c /mnt/cert-(my private cert).pem -u XXXXXXXXXXXX -r i386 -p myimage

note both key files are in the /mnt directory but this does not get bundled so no security worries there.

5. download and install firefox addon "S3 Organiser".

6. Though the S3 Organiser addon, click "Manage Accounts" and
6.1 Enter an account name - this is just an identifier
6.2 Enter your aws access key - this can be found on your "Access Identifiers" page.
6.3 Enter your aws secret key - this also can be found on your "Access Identifiers" page.

7. In AWS management console create an S3 volume on your aws management console - follow link "Volumes" under "ELASTIC BLOCK STORE"

8. In S3 Organiser create a "bucket/directory" on the right pane - note, buckets are created inside volumes, hence the order 8 after 7. I suggest you name it anything in the lines of my-ami-images, etc

9. back on the console run

ec2-upload-bundle -b my-ami-images-or-whatever-you-named-your-bucket -m /mnt/ami/myimage.manifest.xml -a (your aws access key) -s (your aws secret key) --location EU

Note, I'm located in the EU. If you are in the US or Asia the --location switch will probably need tweaking.

10. Go to the aws management console and click "Register a new AMI", the AMI Manifest Path will be (your bucket name)/(your manifest.xml file name). Click Register and you should see it listed. Then you'll have an option to make it public by changing permissions if you wish.

I tried 4 tutorials before getting a result. Some of the stuff was from prior knowledge - I've been playing around with aws for a few years on and off and started running instances in the last few months.

Anyway, good luck with your images and thanks to branajam who put me on the right track.

No comments: