Voiced by Amazon Polly
Amazon Elastic Compute Cloud (EC2) instances are the central part of Amazon.com’s cloud computing platform, Amazon Web Services (AWS). An instance type determines the hardware of the host computer used. Each instance type offers different compute and memory capabilities. Amazon Machine Image (AMI) provides the software profile of the EC2 instance including OS, applications installed, services started by default, etc.
Thus, EC2 allows scalable deployment of applications by providing a web service through which a user can boot an AMI to create a virtual machine, which Amazon calls an “instance”, containing any desired software. AWS supports two different types of virtualization for EC2 instances:
1. Para Virtualization (PV)
2. Hardware-assisted Virtual Machine (HVM)
What exactly is PV and HVM?
Let’s dig in deep through this by considering the way they are virtualized.
Amazon EC2 relies on Xen Virtualization for launching all of its instances.
Every physical machine has a hypervisor running on it. A Xen hypervisor allows multiple instances to share a single hardware platform. A hardware on which a hypervisor is running one or more virtual machines is called a Host machine. Each virtual machine is called a Guest machine.
Xen supports two types of virtualization:
a. Xen Para-virtualization ( PV )
b. Xen Full virtualization ( HVM )
These AMIs boot with a special boot loader called PV-GRUB. The ability of the guest kernel to communicate directly with the hypervisor results in greater performance levels than other virtualization approaches but they cannot take advantage of hardware extensions such as enhanced networking, GPU etc. The guest OS in this case is aware that it is virtualized. Para-virtualized AMIs support only Linux.
b. Hardware-assisted virtual machine or (Full Virtualization)
HVM instances are presented with a fully virtualized set of hardware and they boot by executing the master boot record of the root block device of the image. It provides the ability to run an operating system directly on top of a virtual machine without any modification. It provides complete hardware isolation. HVM AMIs take advantage of enhanced networking and GPU processing. In order to pass through instructions to specialized network and GPU devices, the guest OS needs to be able to have access to the native hardware platform, HVM virtualization provides this access. Also, the hardware provides support to run independently for each OS. HVM AMIs support both Linux and Windows. Historically, PV machines provided better performance than HVM machines in many cases, but because of enhancements in HVM virtualization and the availability of PV drivers for HVM AMIs, this is no longer true.
Network performance in a Para-virtualized instance is very low whereas network performance in Hardware-assisted virtual instance is low to moderate.
Unlike PV machines, HVM machines can take advantage of hardware extensions that provide fast access to the underlying hardware on the host system.
PV drivers are now available for HVM machines, with these PV on HVM drivers, HVM machines can get the same, or better, performance than para virtual machines.
This is the reason why it is recommended using HVMs as they provide better support (linux & windows), stability and cost less when compared to PV.
Migration from PV to HVM
The migration from PV to HVM requires some grub and kernel level changes.
The high-level steps are mentioned below:
1. Install grub on your source instance.
2. Launch a PV instance.
3. Attach the source and destination volumes to the PV instance.
4. Partition the destination volume and duplicate the data from source volume to destination volume.
5. Modify the configuration files on the destination volume and install grub.
6. Create a snapshot of the destination volume and register an AMI.
7. Launch a new HVM machine from the AMI which you created in the above step.
In my next blog I will provide the step-by-step details on how to move a RHEL-based PV machine to HVM, expanding the above points.
Let me know if you have any questions by commenting below.
WRITTEN BY CloudThat