Create AMI image of an EC2 instance store volume

For my reference, these are the steps involved to create an AMI image backup of an Instance Store EC2 volume.

1. Install AMI tools. Might need to uncomment multiverse locations in /etc/apt/sources.list.

sudo apt-get install ec2-ami-tools

2. Bundle the volume

sudo ec2-bundle-vol -d /tmp -k /mycerts/ec2key.pem --cert /mycerts/cert-xxxxxxxxx.pem -u AWS_ACCOUNT_NUMBER -a -e /tmp -r i386
ec2-bundle-vol --help

This will give you a full set of ec2-bundle-vol options

3. Upload Amazon image to S3

ec2-upload-bundle -b BUCKET_NAME -m /tmp/image.manifest.xml -a AWS_ACCESS_KEY -s AWS_SECRET_ACCESS_KEY
ec2-upload-bundle --help

will give you a full list of options

4. You can now remove the image files from tmp directory, they are stored on S3.

sudo rm -rf /tmp/im*

5. The last step is to register the newly created image on S3 as a private image in EC2. There might be a
command line utility to do this, but I did it manually in AWS console.

  • The last step is to register the newly created image on S3 as a private image in EC2. There might be a
    command line utility to do this, but I did it manually in AWS console.
  • Click on “Register New AMI” button.
  • In the popup window specify the location of your image.manifest.xml file created by ec2-bundle-vol
    command. Typically this path would be something like BUCKET_NAME/image.manifest.xml
  • The image should now be registered as a bootable AMI. In addition to that, the image will be registered
    as a private image and it won’t be visible to the AWS community.

Marko