Azure Virtual Machines

Learn via video courses
Topics Covered

Overview

Microsoft Azure is a cloud computing platform that offers a range of services designed to provide management, scalability, and innovation for a diverse range of businesses or individual's needs. One of the major services within Azure's expansive ecosystem is the Azure Virtual Machines (VMs) that enable users to harness the capabilities of virtualization technology and manage virtualized instances of computing resources.

What Are Virtual Machines?

Virtual Machines (VMs) are virtualized instances of computer systems that emulate the behavior of physical machines. Each VM runs its operating systems and applications while sharing the underlying hardware resources of a physical host. Virtual machines are dynamic which allows for easier migration, backup, and replication of entire computing environments.

Need of Virtual Machines

  • Virtual Machines (VMs) enable efficient utilization of computing resources by running multiple independent instances on a single physical server.
  • The dynamic nature of modern computing requires the ability to scale resources up or down based on demand, a capability provided by VMs.
  • VMs provide an isolated environment with its own OS and applications that improve security and find applications in testing.
  • VMs contribute to high availability by allowing quick and automated migration of workloads in the event of hardware failures.
  • Businesses can optimize costs by running multiple workloads on a shared infrastructure, eliminating the need for dedicated physical servers for each application.

Virtual Machine Architecture

Virtual Machine (VM) architecture involves several key components working together seamlessly to provide isolation, flexibility, and efficiency.

virtual machine architecture

Hypervisor (Virtual Machine Monitor)

The functioning of virtual machines involves a hypervisor, also known as a Virtual Machine Monitor (VMM), which acts as a layer of software or firmware between the physical hardware and the virtual machines. The hypervisor allocates and manages resources such as virtual CPUs, memory, storage, and network interfaces that allow multiple VMs to run on the same physical server concurrently.

There are two types of hypervisors:

  • Type 1 (bare metal) runs directly on the hardware.
  • Type 2 (hosted) runs on top of an existing operating system.

hypervisor types

Host Operating System

In the case of Type 2 hypervisors, there is a host operating system that interacts with the hardware. This OS facilitates the functioning of the hypervisor, serving as an intermediary between the virtual machines and the physical resources.

Guest Operating System

Within each VM, a guest operating system runs alongside applications. The guest OS interacts with the virtualized hardware resources provided by the hypervisor, believing it is running on dedicated physical hardware.

Location of Azure Virtual Machines

When creating a Virtual Machine (VM) in Microsoft Azure, you are asked to select a location for your VM. The location property refers to the geographical region where your VM's resources will be provisioned. This decision impacts various aspects of your VM's functionality and accessibility such as:

  • Choosing a location close to your intended user base or other Azure services can minimize latency, resulting in better performance for your applications and services.
  • Placing your VM in a region with multiple data centers enhances high availability. If one data center encounters issues, your VM can seamlessly failover to another within the same region.
  • Since not all Azure services are available in every region, selecting a region with the necessary resources such as sizes and storage options ensures that your VM can utilize the desired configurations.

Microsoft Azure supports several regions in India, providing users with options for deploying their VMs. Some of the supported regions include:

  • South India (Chennai)
  • Central India (Pune)
  • West India (Mumbai)

Size of Azure Virtual Machines

General Purpose Virtual Machines:

B-series:
Offers a cost-effective solution with burstable performance.

  • Use Case:
    For workloads with varying CPU requirements such as development and test servers, low-traffic web servers, and small databases.
  • Limitations:
    Has a baseline performance that, if exceeded consistently, may result in temporary bandwidth losses.
  • Considerations:
    Ideal for scenarios where burstable CPU performance is valuable, but consistent high CPU usage may require a different series.

D-series:
Provides a balanced CPU-to-memory ratio, suitable for applications demanding moderate performance.

  • Use Case:
    Web servers, small to medium databases, and applications that require a balanced mix of CPU and memory resources.
  • Limitations:
    May not be optimal for extremely CPU or memory-intensive workloads.
  • Considerations:
    A good choice for applications with moderate resource demands, offering a good balance between CPU and memory.

Compute Optimized Virtual Machines:

F-series:
Designed for compute-intensive tasks, offering a high CPU-to-memory ratio.

  • Use Case:
    Batch processing, scientific modeling, and applications requiring substantial computing power.
  • Limitations:
    Limited in terms of memory, so may not be suitable for memory-intensive workloads.
  • Considerations:
    Ideal for applications that heavily rely on CPU performance and do not have extensive memory requirements.

Memory Optimized Virtual Machines:

E-series:
Offers a high memory-to-CPU ratio, for memory-intensive applications.

  • Use Case:
    Large in-memory databases, real-time analytics, and applications with high memory demands.
  • Limitations:
    May have lower CPU performance compared to other series, making them less suitable for compute-intensive tasks.
  • Considerations:
    Choose E-series when your workload demands a significant amount of memory, and CPU performance is secondary.

M-series:
Provide a balance between high memory capacity and a significant number of CPU cores.

  • Use Case:
    Memory-intensive applications that require both memory and processing power.
  • Limitations:
    May have higher costs compared to other series, especially if the application doesn't require both high memory and CPU.
  • Considerations:
    Optimal for workloads that demand substantial memory and a considerable number of CPU cores.

Mv2-series:
Extension of the M-series, offering even higher memory capacity and faster processors.

  • Use Case:
    Memory-intensive applications that require extremely large memory sizes and high-speed processors, such as SAP HANA.
  • Limitations:
    Higher costs compared to M-series, best suited for applications that demand the highest memory capacities available.
  • Considerations:
    Only for the most memory-intensive workloads with the need for both massive memory sizes and processing speed.

Storage Optimized Virtual Machines:

L-series:
Optimized for storage-intensive workloads, providing high disk throughput and I/O.

  • Use Case:
    Big data analytics, data warehousing, and applications with substantial storage requirements.
  • Limitations:
    May not be the most cost-effective choice for workloads that don't heavily rely on storage.
  • Considerations:
    Optimal for scenarios where fast and efficient storage access is a critical requirement.

GPU Optimized Virtual Machines:

N-series:
Provides high computing power with single or multiple GPUs for deep learning or machine learning tasks.

  • Use Case:
    Deep learning, gaming applications, simulations, and graphics-intensive workloads.
  • Limitations:
    Higher cost compared to non-GPU VMs, may not be necessary for workloads that don't leverage GPU acceleration.
  • Considerations:
    Choose N-series when GPU acceleration is crucial for your application's performance.

High-Performance Compute Virtual Machines:

H-series:
Designed for high-performance computing tasks, featuring fast CPUs and high memory bandwidth.

  • Use Case:
    Molecular modeling, computational fluid dynamics (CFD), and financial analytics.
  • Limitations:
    Higher cost, may be overkill for less demanding workloads that do not require substantial computing power.
  • Considerations:
    Ideal for applications demanding significant computational power and memory bandwidth.

Creating Azure Virtual Machines in Azure

Creating Azure Virtual Machines (VMs) involves several steps such as:

  • Open your browser and navigate to the Azure Portal. Sign in with your Azure account.
  • In the Azure Portal, click on Create a resource. On the Create a Resource page, click on Virtual Machine.

create resources on azure portal

  • In the basics tab, fill out the following information:
    • Select the subscription you want to use for billing and management of the VM.
    • Resource Group is a logical container for resources deployed in Azure that helps in managing a group of resources.
    • Enter a unique name to your VM.
    • Choose the Azure region where the VM's resources will be physically located.

project details section in basics tab

  • Choose "Ubuntu Server 22.04 LTS - Gen2" or another image based on your application requirements.
  • Choose the size (hardware specifications) for your VM. Sizes vary in terms of CPU, memory, and disk space.

instance details page in basics tab

  • In the Administrator account section, Choose the SSH public key method to authenticate with your VM.
  • Provide a username to access the VM and leave the public key source option to Generate a new key pair and provide a name for your new key.

administrator account section in basics tab

  • Configure inbound port rules to control the traffic allowed to reach your VM. Select the Allow Sected Ports option and set the necessary rules, such as allowing SSH (port 22) and internet(HTTP and HTTPS) for Linux VM.

inbound port rules

  • Choose between Standard HDD, Standard SSD, and Premium SSD for the OS disk in the Disks Tab. Select options like size and type.
  • Review the configuration settings.
  • Click Review + create and then download the newly generated SSH key pair.
  • Finally, click on Create to initiate the VM creation process.
  • After the creation of your VM, go to the VM resource in the Azure Portal. Under the Connect tab, note down the SSH command provided.
  • Open a terminal on your local machine. The syntax of the SSH command to connect with your VM is:

Replace <username> with your chosen username and <public-ip-address> with the VM's public IP address. You will be prompted to enter your SSH private key passphrase. After entering the passphrase, you'll be connected to your Azure VM.

Cost of Virtual Machines

Factors influencing Cost of VM

  • Operating System/Software:
    The choice of operating system (OS) which includes a variety of both Linux and Windows OS. Certain OS options may incur licensing fees, and specialized software may have associated costs.
  • Category:
    Different VM categories, such as General Purpose, Compute Optimized, Memory Optimized, and Storage Optimized, have varying price points based on their configurations and performance characteristics.
  • VM Series:
    VM series selection, like Bs-series, D-series, N-series, etc., influences costs. Each series is tailored for specific workloads, and their pricing reflects the underlying hardware and capabilities.
  • Region:
    Azure VMs are available in different regions globally, and pricing can vary based on the chosen region.
  • Pricing Model or Savings Plan:
    Pay-as-you-go pricing is based on hourly usage, while Savings Plans offer discounted rates for commitments of 1 or 3 years.

For an Azure VM of B-series with Ubuntu OS/Software in the general purpose category deployed in the Central India region with a Savings plan (1 & 3 years), the price is:

InstanceCore(s)RAMTemporary StoragePay as you go1 Year Savings Plan3 Year Savings PlanSpot
B1ls10.5 GiB4 GiB₹1.2168/hour₹1.0651/hour₹0.9560/hour– –
B1s11 GiB4 GiB₹1.6835/hour₹1.3810/hour₹1.1610/hour– –
B1ms12 GiB4 GiB₹2.6170/hour₹2.0111/hour₹1.5727/hour– –
B2s24 GiB8 GiB₹4.4839/hour₹3.2721/hour₹2.3945/hour– –
B2ms28 GiB16 GiB₹8.2177/hour₹5.7941/hour₹4.0397/hour– –

Some other factors that influence costs in VM include:

  • Type of the virtual hard disk (VHD). Standard HDD, Standard SSD, and Premium SSD have different pricing, and the amount of data stored impacts costs.
  • Data transfer costs depend on the amount of data moved in and out of the Azure data centers. Outbound data transfer from Azure to the internet and between Azure regions incurs charges.
  • Usage of additional Azure services, such as load balancers, network gateways, and security services, contributes to the overall cost.
  • Reserved IP addresses and associated costs can be incurred based on the number of reserved IPs associated with the VM.
  • Enabling backup and disaster recovery solutions adds to the cost due to the replication of data in multiple data centers.

Conclusion

  • Microsoft Azure is a cloud computing platform that provides Azure Virtual Machines (VMs) as a service. VMs are virtualized systems that provide users with notable advantages including autonomy, scalability, and efficient resource utilization within the cloud environment.
  • The architecture of Azure VMs has different layers with the hypervisor managing various resources for robust performance of virtualized environments with a focus on isolation, security, and seamless resource allocation.
  • Azure offers a diverse array of VM types, including general purpose, compute, memory, and storage optimization, along with specialized categories like GPU Optimized and High-Performance Compute. Each of the types of VM has different categories which greatly impact the features, application, and price of the VM.
  • The creation of an Azure VM encompasses key configurations like subscription, resource group, VM name, region, image(OS type), selecting the category of VM and series, creating user, authentication using SSH keys or password, and inbound/outbound rules.
  • Azure's pricing models are diverse and focused on factors like OS, VM type, category, and size. Pay-as-you-go options align costs with active VM usage, while monthly payment plans offer flexibility for sustained usage. There are also options to reserve VM for a fixed period to reduce the fees of VM.