- Create an EBS volume (if converting from an S3 backed AMI then create it as 10Gb in size)
- Attach the EBS volume to your running instance
- Stop running services that may be locking files, etc, such as MySQL
At this point, you're ready to copy the contents of your root drive onto the EBS volume. A couple of additional points here - it makes sense to stop any services possible to make the transfer as clean as possible. One of our readers has suggested an alternative approach to dd in the comments - i've included it here as an option for completeness.
Option 1: dd
- Copy the root drive to the EBS volume -
dd bs=65536 if=SOURCE of=TARGET. Replace SOURCE with the boot volume, e.g. /dev/sda1 and TARGET with the EBS volume, e.g. /dev/sdj fsck TARGETmkdir /migratemount TARGET /migrate
Option 2: rsync
I suspect with this route you'd need to exclude any directories used for mounting other volumes, otherwise your rsync will run out of space on the target device.
mkfs.ext3 TARGETmount TARGET /migratersync -ax --progress / /migraterm -rf /migrate/migrate
And then continue..
umount TARGETec2-register -n NAME --architecture ARCH --block-device-mapping /dev/sda1=SNAPSHOT:SIZE:false. There are a number of options here - some of which you can set when starting the instance if you prefer. NAME is the name of the AMI, ARCH is the architecture (i386 or x86_64). The block device mapping paramaters set the EBS snapshot to use as the boot device, the second parameter sets the size to 15Gb and final parameter sets the delete-on-termination attribute to false.More details, as usual, can be found in the command line reference.


10 comments
Comment on Create a bootable EBS AMI from a running instance by Chris Anderton
May 11th, 2010 @ 10:52 – permalink
Comment on Create a bootable EBS AMI from a running instance by Mateu
July 29th, 2010 @ 23:04 – permalink
Comment on Create a bootable EBS AMI from a running instance by Chris Anderton
July 31st, 2010 @ 21:22 – permalink
Comment on Create a bootable EBS AMI from a running instance by Chris Snyder
August 31st, 2010 @ 23:08 – permalink
Comment on Create a bootable EBS AMI from a running instance by Chris Anderton
September 24th, 2010 @ 18:22 – permalink
Comment on Create a bootable EBS AMI from a running instance by jeremy
November 7th, 2010 @ 05:46 – permalink
Comment on Create a bootable EBS AMI from a running instance by Kevin
February 17th, 2011 @ 18:41 – permalink
Comment on Create a bootable EBS AMI from a running instance by vincent
June 26th, 2011 @ 17:04 – permalink
Comment on Create a bootable EBS AMI from a running instance by Tim Oxley
July 5th, 2011 @ 07:38 – permalink
Comment on Create a bootable EBS AMI from a running instance by Chris Anderton
July 5th, 2011 @ 10:48 – permalink
Leave a reply
You can use Markdown in your comment as well as plain HTML. You can use
<filter:jscode lang="ruby">and</filter:jscode>tags to surround code blocks (supported languages are css, html, javascript and ruby). Your email address will not be published.If your comment doesn’t appear immediately after posting it could have been marked as spam. Don’t worry: we regularly check for and approve incorrectly filtered comments so you shouldn’t have to wait too long for it to be shown.