Skip to main content

Exploring Nested Virtualization: Support Options for Azure and AWS

Nested virtualization refers to the capability of running virtual machines inside other virtual machines. In this scenario, a hypervisor, also known as a Virtual Machine Monitor (VMM), runs on virtualized hardware and allows for the creation and management of multiple VMs. Within one of these VMs, a second hypervisor is installed, enabling the creation of additional VMs within the context of the first virtualized environment.

Nested Virtualization
Nested Virtualization

 

Traditional Virtualization

Traditional virtualization refers to the practice of creating and managing virtual machines on physical hardware using a hypervisor or VMM. The primary goal of traditional virtualization is to efficiently utilize hardware resources by enabling multiple isolated and independent operating system instances to run on a single physical machine.

Why Nested Virtualization?

Nested virtualization enables complex system simulations for testing, development, education, and research by running VMs within VMs, supported by cloud services for flexibility. It’s vital for software like GNS3 for network simulations, VMware for virtualization feature testing, Hyper-V for Windows Server environments, QEMU/KVM for OS research, and Docker/Kubernetes for container orchestration, along with security research and IT training environments.

How Nested Virtualization Works?

Nested virtualization works by allowing a virtual machine to host its own hypervisor, creating a multi-layered or nested virtualization environment. Here’s a step-by-step explanation of how nested virtualization functions:

  • Primary Hypervisor (Host Hypervisor):

At the outermost layer is the primary hypervisor, also known as the host hypervisor, installed directly on the physical hardware. This hypervisor manages and allocates resources to the first level of VMs.

  • Guest VMs (Level 1 VMs):

Within the host hypervisor, multiple VMs are created, and each VM operates as if it were an independent physical machine. These are the first-level VMs, running their own operating systems and applications.

  • Hypervisor within a VM (Nested Hypervisor):

Inside one of the Level 1 VMs, a second hypervisor is installed. This creates a scenario where a virtualized environment (Level 1 VM) is hosting its own hypervisor.

  • Guest VMs within the Nested Hypervisor (Level 2 VMs):

The nested hypervisor inside the Level 1 VM can then create and manage additional VMs, referred to as Level 2 VMs. These VMs operate within the context of the nested virtualization environment.

  • Hardware Virtualization Extensions:

For efficient nested virtualization, hardware-level virtualization extensions, such as Intel VT-x or AMD-V, are typically required. These extensions allow the nested hypervisor to take advantage of hardware-assisted virtualization, enhancing performance and compatibility.

  • Pass-through of Virtualization Extensions:

The primary hypervisor must pass through virtualization extensions to the Level 1 VM that hosts the nested hypervisor. This enables the nested hypervisor to create and manage VMs with hardware-level virtualization support.

  • Performance Considerations:

Nested virtualization may introduce additional overhead compared to non-nested virtualization scenarios. The performance of nested VMs can be influenced by factors such as the configuration of the host hardware, the type of hypervisors used, and the workload of the VMs.

Exploring the Practical Uses of Nested Virtualization

Testing and Development:

  • Isolated Testing Environments: Nested VMs provide safe and isolated environments for testing software compatibility, updates, or bug fixes. You can create multiple nested VMs with different configurations, allowing for thorough testing without affecting the main cloud VM or other workloads.
  • Development Workflows: Developers can leverage nested VMs to set up custom development environments with specific tools and operating systems they need. This streamlines development processes by providing a consistent and isolated environment for each project

Specialized Applications:

  • Running Legacy Applications: Some businesses rely on older software that might not be compatible with newer hardware or operating systems. Nested VMs can create isolated environments to run these legacy applications alongside modern workloads within the cloud VM.
  • Emulators and Simulators: Nested VMs can be used to run specialized software like emulators or simulators that require specific configurations. This allows for testing and development activities involving these tools within the cloud environment.

Security and Compliance:

  • Multi-tenant Environments: Nested VMs can be used to create isolated environments for different tenants within a single cloud VM. This provides a layer of security and isolation, ensuring data segregation and compliance with regulations.

Advanced Scenarios:

  • Disaster Recovery Testing: Nested VMs can be used to create replicas of production environments for disaster recovery testing. This allows for simulating failover scenarios and validating recovery procedures without risking the main production environment.
  • Microservices Architecture: Nested VMs can be used to deploy complex microservices architectures where each microservice runs in its own isolated environment. This promotes scalability and fault tolerance within the cloud environment.

Nested Virtualization in Microsoft Azure

Azure’s support for nested virtualization spans across various VM families, including the D-series (v3, v4, including both standard and storage-optimized variants), E-series (v3, v4, including both standard and memory-optimized variants), F-series (v2, focusing on a balance of CPU and memory), the FX-series (specialized for high compute performance), and the M-series (optimized for memory and CPU performance). This extensive support, combined with Hyper-V’s robust capabilities and Azure portal’s streamlined configuration tools, ensures a smooth and efficient nested virtualization experience on Azure.

Hyper-V Server 2016

Benefits of Nested Virtualization:

  • Increased Flexibility:

    Create multi-tenant environments where multiple users can run isolated virtual machines on a single Azure VM. This flexibility enables diverse applications, from collaborative workspaces to isolated testing grounds.

  • Enhanced Testing and Development:

    Develop and test software in a virtual machine within another virtual machine, simulating real-world scenarios with greater accuracy and control. This approach accelerates development cycles and ensures quality software.

  • Cost Optimization:

    Utilize nested VMs for specific tasks instead of provisioning dedicated hardware. This potential reduction in hardware costs can significantly optimize your cloud spending.

Nested Virtualization in Amazon Web Services

Currently, AWS doeCurrently, AWS does not officially support nested virtualization on most of its EC2 instances. This limitation exists because standard EC2 instances come with a pre-installed virtualization layer managed by AWS. This pre-existing layer restricts users from directly installing another hypervisor (required for nested virtualization) on top of it.
However, there are some workarounds:

Nested Virtualization in AWS: Workarounds and Supported Approaches

Bare Metal Instances:

  • AWS provides bare metal instances, such as the C5, which offer direct access to hardware.
  • These instances support technologies like Intel VT-x and AMD-V, essential for running another hypervisor (e.g., VMware ESXi or KVM) to create nested VMs.
  • Opting for bare metal instances grants users the highest level of control and flexibility, albeit at a higher cost compared to standard instances.

Nested Virtualization Tools:

  • Third-party tools like QEMU and Firecracker can facilitate running nested VMs on non-bare metal instances. However, these solutions aren’t officially supported by AWS and might encounter limitations in terms of performance and compatibility.
  • It’s worth noting that these tools may be suitable for development and testing environments rather than production use due to these potential limitations.

AMD SEV-SNP Support:

  • AWS has introduced support for AMD Secure Encrypted Virtualization-Secure Nested Paging (SEV-SNP) on select instance types (M6a, C6a, R6a), providing enhanced security features for nested virtualization workloads.

EC2 Instance vs EC2 Bare Metal Instance Architecture Comparison

Comparison of Nested Virtualization Support: AWS vs. Azure

Key differences between Azure and AWS Cloud.

AWS vs Azure

  • Configuration:

Configuration

  • Performance Consideration:

Performance Consideration

  • Additional Features:

Additional Features

Cost Comparison

When comparing the costs associated with nested virtualization support, Azure emerges as a notably more affordable option. Azure’s virtual machines capable of nested virtualization are available at prices starting as low as $0.7 per hour. In contrast, AWS’s bare-metal instances, which support nested virtualization, begin at a significantly higher rate of $3.88 per hour, with prices scaling up to $10.8 per hour. This stark difference in pricing makes Azure a more cost-effective choice for users looking to leverage nested virtualization capabilities. To get an idea of the cost for a specific instance, please check the link provided below.

Azure vs AWS Cost Comparison

This affordability of Azure can be attributed to several key factors:

  • Supported VM Families:
    Azure supports nested virtualization on a wider range of VM families, including D/Ds/Dv4, E/Esv3, and Fsv2, compared to AWS’s limited support on only C5 bare metal instances. This broader availability on Azure can lead to lower costs as you have more choices for finding an instance type that meets your performance and price requirements.
  • Hypervisor Support:
    Azure utilizes Hyper-V, which has built-in support for nested virtualization. This eliminates the need for additional software like VMware ESXi or KVM on Azure, reducing licensing and setup costs.
  • Configuration Complexity:
    Azure’s nested virtualization configuration is more user-friendly and straightforward through the Azure portal. This reduces the need for additional expertise or specialized tools, potentially saving time and associated costs.
  • Reserved VM Instances:
    Azure offers Reserved VM Instances, which allow you to pre-purchase VMs at a discounted rate for consistent workloads. This can be a significant cost-saving option if you have predictable nested virtualization needs.
  • Additional Services:
    While AWS offers dedicated services like VMware Cloud on AWS for nested virtualization, they come at an additional premium. Azure integrates nested virtualization with other services like Azure Lab Services, offering a more cost-effective solution for specific use cases.

These factors combine to position Azure as a highly attractive platform for deploying nested virtualization solutions, especially for users conscious of budget constraints and seeking a balance between cost, performance, and ease of use.

Recommended Nested Cloud To Use For Virtualization.

Both AWS and Azure offer good support for nested virtualization, but there are some key differences to consider. AWS offers better performance with Bare Metal Instances and direct access to CPU, while Azure offers more VM series with nested virtualization support and some additional features like GPU support and live migration for nested VMs. The best platform for you will depend on your specific needs and budget.

Conclusion

Nested virtualization unlocks new possibilities for cloud computing. It creates intricate environments ideal for testing, development, and specialized workloads. By grasping its capabilities and the support offered by cloud providers like Azure and AWS, this technology can be leveraged to strengthen a cloud strategy. Whether raw performance, affordability, or specific features are the priority, a suitable cloud platform exists to empower virtualized environments.

About The Author(s)

Author: Hajra Rafiq, Software Systems and DevOps Engineer

Related Articles

Related Articles

Join Our Free Webinar: Proven Content Tactics to Scale Your Startup!
This is default text for notification bar