Backing up a Volume from Amazon EC2 to Amazon S3 (Also, exporting an image for download)

If you’re having trouble using the traditional methods of exporting a volume out, you can still get it out using the following instructions:

  1. Start up a micro instance using a Linux flavor of your choice.
  2. On your target instance, shut it down and detach the volume.
  3. Attach it to your new micro instance as /dev/sdf
  4. Issue the following command:
    1. # dd if=/dev/sdf | gzip -1 – | pv | aws s3 cp – s3://bucketname/tgtname.gz
    2. Explanation of the above:
      1. dd reads the file bit for bit, we set the input to our block device
      2. We pipe it to gz to compress the byte stream
      3. pv allows us to monitor our progress (you’ll need to do yum install -y pv)
      4. “aws s3 cp -” is the amazon awscli s3 cp command with stdin (-) as the source.

This will result in an exported raw image that you can then download. Keep in mind that this may violate the ToS so read that prior to going forward with the above.

Leave a Reply

Your email address will not be published. Required fields are marked *