Virtual Machine
Virtual Machine is the flagship of the cloud as it's general-purpose computing. The great advantage of working with VMs in the cloud is the ease of automation and scalability compared to an on-premise environment. Although clouds offer many services, usually when we don't want to pay for a SaaS or have more control, we end up creating a VM and configuring what we want.
The disadvantage of using VMs instead of using other Azure services is having to keep everything updated, install correction patches, bugs, and CVEs, in addition to worrying about service high availability by making redundancy in different availability zones. That's why the trend in cloud usage is to use available services whenever possible before going to this scenario, except in case of compliance or company policies.
The size of the chosen VM will be determined by the workload you want to run, this involves processing capacity (number of physical cores), amount of memory, and graphics processing capacity if necessary. We need to choose this configuration from the options offered by Azure, unlike VirtualBox where we define exactly how much processor and memory we want on our local machine. Below we'll talk about VM families.
A VM needs storage which, although defined in the same workflow as VM creation, is a separate resource as we can destroy a VM and keep only the disk to attach to another VM, for example. Disk speed and capacity can also be defined. Storage is charged separately.
In Azure, the disk is a VHD (Virtual Hard Disk) stored in Azure-managed storage. This VHD is basically a file containing the disk data. This file is stored on physical disks that have the chosen speed.
Disk creation starts from a ready operating system image in Azure, like a snapshot. We can create our own images with everything we need installed and save them to start new disks in the future with everything ready. In Azure marketplace we have many images to use and they are identified by the image publisher, offer, SKU, and version.
It's worth remembering that virtual machines are charged by the minute. Stopping a VM means you won't be using processing power anymore and the physical cores and memory go back to being available in Azure, but your disk is stopped. When you turn it on again, the resource will be reallocated for processing what we have on the disk.
Another item that, although it's in the VM creation workflow, is a separate item is the network interface (NIC). We can define a public IP for a network card and even the bandwidth speed; in this case, additional costs will be involved.
Some details about VM pricing:
- A region may have newer machines than others, so not all machine configurations are available in all regions.
- For the same configuration, if available in different regions, the price is different. This happens due to location cost, taxes, and other factors, and unfortunately Brazil is one of the most expensive countries in the world and the United States the cheapest.
- The price also changes based on the operating system that will run due to licensing. As a rule, a Linux machine is cheaper than a Windows machine.
- ARM processor architecture also tends to be cheaper than X86 architecture.
- Latency will change according to the chosen region, so it's worth measuring the cost of having anything in Brazil or elsewhere. It's usually about 35% more expensive in Brazil.
VM Families​
We can't configure exactly the machine we want, but we have plenty of options and surely one will fit your purpose.
VM nomenclature in Azure follows a pattern that helps quickly identify the main characteristics of each VM. A VM's name is composed of different parts that indicate the family, VM size, generation, and in some cases, other specific characteristics.
VM nomenclature in Azure follows a pattern that helps quickly identify the main characteristics of each VM. A VM's name is composed of different parts that indicate the family, VM size, generation, and in some cases, other specific characteristics.
There isn't an exact pattern for nomenclature, but we have some clues from the name.
[Family][Size][Storage Option][Generation]
Nomenclature Components:
- Family:
- B: Economical and Burstable
- D: General Purpose
- E: Memory Optimized
- F: CPU Optimized
- G: Storage Optimized
- H: High Performance Computing
- L: Storage Optimized
- M: Extra Large Memory
- N: GPU Optimized
- Size: (This part varies a lot)
- A number generally associated with the amount of resources like CPUs and memory (for example, 1, 2, 4, 8).
- The higher the number, the more resources the VM will have.
- Usually we have the letter
ato indicate the processor is AMD. - Usually we have the letter
lto indicate the memory value is double the CPU. - I observed that the letter
mordindicates the memory is 4 times the amount of CPU.
- Storage Option:
- s: Premium Storage (for example, D2s_v3).
- v: Indicates the version (for example, D2s_v3, which is the third version of D2s).
- m: Indicates VMs with increased memory (for example, B1ms, which has higher memory for the size).
- Generation:
- v2, v3, etc.: Indicates the generation or version of the VM (for example, D2_v2 is the second generation of D2 VM).
- Other Characteristics:
- (Hybrid): Indicates a VM that can be used for hybrid workloads.
- M (Memory Optimized): As in M-series.
Examples:
-
D2s_v3: D: General Purpose Family. 2: VM size, with 2 vCPUs. s: Premium storage support (SSD). v3: Third generation of this series.
-
B2ms: B: Economical and Burstable Family. 2: VM size, with 2 vCPUs. m: Optimized memory. s: Premium storage support (SSD).
-
NC6: N: GPU Optimized Family. C: GPU-based computing. 6: VM size, with 6 vCPUs.
Whenever you choose a machine, see what's most viable by doing a cost analysis.
https://azure.microsoft.com/en-au/pricing/details/virtual-machines/linux/#pricing