Importing a Virtual Machine into Amazon EC2 (Part 4)

If you would like to read the other parts in this article series please go to:

In the previous article in this series, I showed you how to get the Amazon command line interface installed and working. Now that this interface has been installed, we can move forward with the task of migrating a virtual machine.

In order to migrate a virtual machine to Amazon EC2, the virtual machine must meet certain criteria. Specifically, the virtual machine must run a supported operating system and it must use a compatible virtual hard disk type. The supported operating systems include:

  • Microsoft Windows Server 2012 R2 (Standard, Datacenter)
  • Microsoft Windows Server 2012 (Standard, Datacenter)
  • Microsoft Windows Server 2008 R2 (Standard, Datacenter, Enterprise)
  • Microsoft Windows Server 2008 (Standard, Datacenter, Enterprise)
  • Microsoft Windows Server 2003 R2 (Standard, Datacenter, Enterprise)
  • Microsoft Windows Server 2003 (Standard, Datacenter, Enterprise) with Service Pack 1 (SP1) or later
  • Red Hat Enterprise Linux (RHEL) 5.1-5.11, 6.1-6.6, 7.0-7.1
  • CentOS 5.1-5.11, 6.1-6.6, 7.0-7.1
  • Ubuntu 12.04, 12.10, 13.04, 13.10, 14.04, 14.10
  • Debian 6.0.0-6.0.8, 7.0.0-7.2.0

In case you are wondering, Linux builds such as CentOS 6.0 and Red Hat Enterprise Linux 6.0 are unsupported because they do not contain the required drivers. It is also worth noting that Linux virtual machines can only be migrated if the VM is running a 64-bit version of Linux.

Amazon only supports importing virtual machines that use the following types of virtual hard disks:

  • RAW format
  • VHD (VHDX files do not appear on the list of supported virtual hard disk types)
  • VMDK

Regardless of whether the virtual machine is running Linux or Windows, GUID Partition Tables (GPT) are not supported. Windows virtual machines can use the NTFS file system. Volumes attached to Linux virtual machines can be formatted as ext2, ext3, ext4, Btrfs, JFS, or XFS.

Once you have ensured that your virtual machine meets the requirements listed above, there is an entire laundry list of things that you will have to do in order to get your virtual machine ready for its migration. Before I tell you what those things are, I need to point out that you will have to plan for some down time as a part of the migration process. There is no way to live migrate or to use vMotion to move a running virtual machine from your local data center to the cloud and avoid incurring some downtime in the process. Furthermore, some of the prep work that I am about to talk about has the potential to extend the amount of time during which the virtual machine is unavailable beyond the amount of time that it takes to actually migrate the virtual machine. In other words, some of the prep work might cause the virtual machine to become unavailable before you even begin the migration process.

So now that I have gotten that warning out of the way, let’s talk about the things that you need to do in order to prepare your virtual machine. Some of the preparation tasks are general-purpose and apply to any virtual machine regardless of the operating system that it is running. Other tasks are specific to the virtual machine’s operating system.

Let’s get started by talking about some general-purpose preparation tips. The first thing that you should do is to completely disable any antivirus software or any other type of security software that is running on the virtual machine. You don’t have to completely remove the software, but it does need to be disabled so that it does not interfere with the migration process. This might be a good time to go ahead and take the virtual machine off-line because you probably don’t want people accessing the virtual machine while the antivirus software, IDS software, etc. is disabled.

The next thing that you will need to do is to disconnect any CD-ROM drives or DVD-ROM drives from the virtual machine. This requirement holds true regardless of whether the virtual machine is linked to a physical drive or to an ISO file. The reason for this is that your physical drive is not going to be accessible from the cloud, so the virtual machine needs to be disassociated from it. Similarly, virtual DVD or CD drives that are based on ISO files also have to be disabled because the ISO file exists outside of the virtual machine and will not be accessible once the virtual machine has been moved to the cloud.

If your virtual machine is running in a VMware environment then you will need to uninstall the VMware tools from the virtual machine as a part of the prep work. Amazon doesn’t really give a reason for this, but presumably the host servers that Amazon uses are not running VMware.

I mentioned earlier that some of the tasks that you have to complete in order to prepare your virtual machine for migration have the potential to bring the virtual machine off-line before you even begin the migration process. Technically, the virtual machine has to be shut down before it can be migrated. Even so, this next step has the potential to force your virtual machine off-line.

With that said, you will need to remove any static IP addresses from your virtual machine. In most cases, you can configure the virtual machine to acquire a dynamic IP address from a DHCP server. If on the other hand, your virtual machine absolutely requires a static IP address then you will need to assign it a non-reserved, private IP address from the Amazon Virtual Private Cloud. The Amazon Virtual Private Cloud reserves the first four IP addresses, so you will have to choose an IP address from the Virtual Private Cloud subnet that is not already in use and that is not one of the first four addresses.

That about does it for the general-purpose preparation steps, but as I said earlier there are some operating system specific preparation tasks that you must complete. I want to wrap up this article by talking about some of the tasks required for virtual machines that are running Linux operating systems.

For Linux virtual machines you will need to enable Secure Shell for remote access, and you will need to configure your host firewall to allow Secure Shell. You will also have to configure a non-root user to use public key-based SSH to access your instance. If you neglect these steps then you won’t be able to access your instance after the migration process completes.

One last requirement for Linux virtual machines is that the virtual machine must use a GRUB (GRUB legacy) or a GRUB 2 boot loader.

Conclusion

As you can see, there are a number of different things that you will have to do in order to prepare a virtual machine to be migrated to the Amazon cloud. Because some of these preparation steps cause the virtual machine’s configuration to be modified, I strongly recommend making a backup prior to beginning the prep work.

In the next article in this series, I plan to continue the discussion by talking about the things that you will need to do to prepare Windows virtual machines for migration to the cloud. If you would like to read ahead and learn more about the migration process, you can access Amazon’s documentation here.

If you would like to read the other parts in this article series please go to:

Leave a Comment

Your email address will not be published.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top