Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a large number of ubuntu servers currently hosted on AWS EC2. Many of these servers are accessed infrequently and for cost-saving we now want to move these over to our local site and terminate them on Amazon.

Most of the servers are EBS-backed and we have created AMI images of these using the Management Console.

I was hoping to download the existing AMI's and then use these images to build the new servers locally so that we don't have to re-install the application stack and configurations from scratch. 1) Is this possible? 2) How would one go about downloading this AMI? (I was hoping that it would be possible from the management console somehow.) 3) How would the AMI need to be changed so that it can be used for installation?

How can I run the Ubuntu EC2 AMI images locally? seems to suggest an answer, but the article that it links to contains important links that are no longer accessible. It also seems to suggest a rather elaborate process. seems to suggest that it is possible to do this, but doesn't go into any explanation of how to actually download the image while suggests that it is not possible.

share|improve this question
up vote 6 down vote accepted

From what I've found in researching bits and pieces, it's not easy to do.

To get the image, you can take a snapshot, and mount it to a running instance then just copy down the contents to a local raw file with something like dd over ssh. Then disconnect the volume from the instance, verify you have the image locally stored, and delete the EBS block. That part isn't too difficult if you know how to use DD/compression/ssh to transfer the image and mount it as a local loopback to examine the raw disk image. Tutorials are available for that.

The hard part is getting it to boot. Depending on how your instance was created, it seems that the kernels are usually stripped down Xen kernels, so they may lack hardware support for something like VMWare. You'd have to mount the disk image and install a more generic kernel along with modifying the boot manager. You also would have to iron out the networking, as Amazon had some tweaks put in for handling their virtual network management (DHCP assignments, firewall, routing).

This must be possible; there are tools and tutorials for uploading your own AMI's into the Amazon cloud, just there isn't too much out there on how to go the other way. By the time you're done figuring out how to unravel the spaghetti of configuration hassles you might be better off just getting a list of dependencies for your applications and transferring the configurations and installing dependencies as a new local machine.

Bottom's probably possible, it's possible to go the other way in the conversion, but with the hassle involved unless you're skilled at Linux surgery on the kernel and configuration you might as well use your EC2 instances as a template for rebuilding from the bottom up.

share|improve this answer
If the volume was originally imported, you can use the cli tools to export it back out. However, if it was not originally imported, as @Bart-Silverstrim suggests, you may want to use dd over ssh, for which see… – outis nihil Apr 3 '15 at 13:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.