Virtualization in Amazon Web Services
Amazon Elastic Compute Cloud instances (EC2) are the heart of Amazon.com’s cloud computing platform Amazon Web Services (AWS). An instance type is the type of host computer that is used. Each instance type has different memory and compute capabilities. Amazon Machine Image (AMI), which provides information about the software profile for an EC2 instance, including OS, installed applications, and services that were started by default, gives the software profile.
EC2 allows for the scaling deployment of applications through a web service that allows a user to boot an AMI and create a virtual machine. This Amazon term is an “instance”, which can contain any software. AWS supports two types of virtualization for EC2 instances.
1. Para Virtualization (PV)
2. Hardware-assisted Virtual Machine (HVM)
What is PV and HVM exactly? Let’s get into the details by looking at how they are virtualized.
Amazon EC2 relies upon Xen Virtualization to launch all its instances.
Every physical machine has its own hypervisor. Multiple instances can share a single platform with Xen hypervisor. A Host machine is a hardware platform on which a hypervisor runs one or more virtual machines. Each virtual machine is called Guest machine.
Xen supports virtualization in two ways:
a. Xen Para-virtualization ( PV )
b. Xen Virtualization ( HVM ).
These AMIs boot using a special bootloader called PV-GRUB. Although the guest kernel can communicate directly with the hypervisor, it does not allow them to take advantage of hardware extensions like enhanced networking or GPU. In this instance, the guest OS is aware that it has been virtualized. Para-virtualized AMIs only support Linux.
b. Hardware-assisted Virtual Machine or (Full virtualization)
HVM instances are presented a fully virtualized hardware set and boot by executing a master boot record from the root block device. It allows you to run an operating system directly over a virtual machine. It offers complete hardware isolation. HVM AMIs benefit from enhanced networking and GPU processing. HVM virtualization allows guest OS to access the native hardware platform in order to pass instructions to specialized network devices and GPU devices. The hardware supports each OS running independently. HVM AMIs can run on both Linux and Windows. In many cases, PV machines were better than HVM machines. However, due to improvements in HVM virtualization, and the availability PV drivers for HVM-AMIs, this is no more true.
Para-virtualized instances have very poor network performance, whereas Hardware-assisted virtual instances have good to excellent network performance.
HVM machines are able to take advantage of hardware extensions, which allow for fast access to the underlying hardware of the host system.
PV drivers are now available to HVM machines. With these PV on HVM driver, HVM can get the same or better performance as para virtual machines.
HVMs are recommended because they offer better support (linux and windows), stability, and cost less than PV.
Migration from PV to VVM
Migration from PV to HVM requires kernel and grub level changes.
Below are the high-level steps:
1. Install grub on the source instance.
2. Start a PV instance.
3. Attach the source- and destination volumes to your PV instance
4. Split the destination volume into two volumes and duplicate the data from the source volume to the destination volume.
5. Modify the configuration files of the destination volume, and then install grub
6. Take a picture of the destination volume to register an AMI.
7. You can now launch a new HVM from the AMI you created in the previous step.