Step 1) Copy your X.509 certificate and private key to your instance.
scp -i id_rsa-gsg-keypair pk-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem cert-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem root@domU-12-34-31-00-00-05.compute-1.amazonaws.com:/mnt
This is done on your local desktop. Than, your security files will be stored in /mnt directory of your instance.
Step 2) Now you have to bundle your instance with the commmand:
ec2-bundle-vol -d /mnt -k /mnt/pk-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem -c /mnt/cert-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem -u 495219933132 -r i386 -p sampleimage
This takes some time. (several minutes) If it was successful, you can see the bundled files under your /mnt directory. They are bunch of files with names of smapleimage*.
Step 3) Upload bundled files to S3 from your instance
ec2-upload-bundle -b
I had some problem with this process. Although I have S3 access, this command complained that I don't have S3 access. Interestingly, I created a bucket in S3 manually, and it worked.
I use the firefox extension that recommanded in a EC2 forum.
http://www.s3fox.net/
It is quite useful. If I want to sync part of my disk, it would be a great tool.
Step 4) Then, logout your instance, and on your desktop,
ec2-register
Now you can see your machine image from,
ec2-describe-images -o self
Step 5) That's it! whenever you want to reload your machine image,
ec2-run-instances ami-5bae4b32
for the longer version of tutorial,
http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/