How to move *all* the installed software on the EC2 isntance to EBS

amazon ec2amazon-ebs

I got started with Eric Hammond's great article over at http://aws.amazon.com/articles/1663
where he goes through installing MySQL and configuring it to use EBS. I got that going.

I also have a lot of other stuff installed on that EC2 instance: Rails, a bunch of gems, Nginx+Passenger and so on – my understanding is that unless I explicitly configure it to use EBS, all of this sits on the EC2 instance's ephemeral storage – right? How can I move all the software I have installed to EBS – or better yet how can I set up such that going forward also any new gems etc that I install also go to the EBS volume?

Best Answer

Start with an ebs root based instance to begin with.

I've converted most of mine to these.

I did try to convert some existing ones to ebs only,but after 3 or 4 hours, I found out I could just re-install all the needed binary packages, and copy across our folks code,data,etc

From https://console.aws.amazon.com/ec2/home?region=us-east-1#s=LaunchInstanceWizard

(the launch instance button),

  1. click the "Viewing" drop-down that defaults to all images and pick EBS images. Many Fedora,Ubuntu, Amazon-Linux, to pick from. Note: on all these it shows "Root Device: EBS"...

  2. Boot it with your other choices, certs, region, architecture,etc.

  3. login to it,customize it, fix it up as you see fit.

  4. stop it. NOT TERMINATE

  5. start it again, and everything on root is as you left it.

There are some startup scripts amazon or somebody supplies that re-init /mnt each time, but I just have separate EBS backups of our base software.

This setup is ideal for us, where we do not have huge load spikes,but instead have occasional tasks that take 2 x our regular hosts, and so I've got half a dozen instances that are "STOPPED" and not getting any CPU charges (but they do take up minuscule S3 storage charges).

So this leaves you with permanent root stuff,not transient,and you stop,start,as you need.

Any of the EBS instances, you can "boot more like this", if you need 20 in a hurry.

Note2: If you attach big EBS volumes, to an EBS based AMI and pick Boot more like this it makes copies of those attached volumes. and that can take a while to have it boot, as well as unexpected storage charges with all these funky snapshots laying about.

You can probably do this thru the cli tools also,but I found the console easy enough.