4

I have several Amazon AWS EC2 virtual machines that I created on AWS EC2. They were not imported, they were created there. I would like to export these machines in order to achieve local backups, and a local testing environment.

I have looked a lot of places, and found tons of information that says you can only export a VM from EC2 if you imported into EC2 originally. I have also found information that says you can only import into EC2 if the machine was originally exported from EC2.

My question is, is it possible to export a VM that was built on EC2, and somehow get it locally. I have read that you have to back it up to an S3 Bucket, and then download it, but Amazon's documentation says that you can only export it from there if it was originally imported.

Here are the links on serverfault that I found this question asked, but not answered.

Copy an Amazon EC2 Instance to use locally

Archiving Amazon AWS instances

  • Have you tried doing a snapshot of the volume and copying it to an S3 bucket? – Craig Dec 1 '14 at 23:28
  • 2
    The idea is that your provisioning can reproduce the VM layout and configuration, and your image does not actually contain any persistent data, so why would you need to? Just provision locally... That's the theory at least ;) – HBruijn Dec 1 '14 at 23:37
  • This is where a configuration management system like Ansible works. Provision the same base OS (I like Ubuntu for this) on local dev and production and use Ansible to make a reproducible recipe for building the server from there. – ceejayoz Dec 2 '14 at 0:42
  • Taking a snapshot of the volume and copying to an S3 bucket is the recommended method, but Amazons docs say that you can't export the image unless it was imported there first. However, their documentation also says that you can't Import it unless it was originally exported from ec2. So according to Amazon's docs, you can't actually import or export.....I'm sure it's a typo, but I was trying to find out if anyone has successfully completed this action. – trueCamelType Dec 2 '14 at 14:12
  • @HBruijn I'm not sure I followed what you are saying. Did you mean I should just use a config. management tool like ceejayoz recommended, or were you saying something else? – trueCamelType Dec 2 '14 at 14:14
1

if you could export an aws instance / image to openstack, for instance, bezos would be losing money..... the whole concept of the cloud is that instances are ephemeral and conf mgmt (puppet, salt, etc) is what makes them do what they do. data volumes are a different however, and that is obviously possible.

to actually boot an aws instance on your local hardware would be difficult. try snapshoting instance root drive, then mounting snapshot'd volume onto a newly lauched image, and then dd it to file and rsync to your local machine. then the fun begins.... you might be able to have it boot locally but probably impossible... never tried that as its not really fruitful

1

Yes, I was looking too for the answer, and recently I found that Amazon ec2 cannot tolerate importing instances created first time with ec2 hyper-visor.

What you can do is migrate the content of the VM to another placement, a reserved instance more cheaper for example, by creating a snapshot of an ebs boot partition in order to recreate the same vm. Preferably you would migrate within the same availability zone, so it's more cost effective. But migration outside the Amazon regions is impossible.

1

If you are migrating Windows Server and could log in the VM, using Disk2VHD command would be much easier way. I migrate several EC2 VMs to Azure, and believe you can migrate to a local Hyper-V server as well. https://tombwu.wordpress.com/2015/07/10/migrate-windows-server-from-aws-ec2-to-azure/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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