DEV Community

Cover image for Understanding Azure Virtual Machine Scale Sets (VMSS) and How to Create It using Azure portal.

Understanding Azure Virtual Machine Scale Sets (VMSS) and How to Create It using Azure portal.

Virtual Machine Scale Sets (VMSS) is an interesting service offered by Microsoft Azure, it helps to create and manage a set of identical, auto-scaling Virtual Machines (VMs). The number of VM instances can automatically increase or decrease based on scheduled conditions.

Azure Virtual Machine Scale Sets lets you create and manage a group of load balanced VMs whose number of VM instances can automatically increase or decrease in response to demand or based on a defined schedule. It has the following Advantages.

  • Easy to create and manage multiple VMs
  • Provides high availability and application resiliency by distributing VMs across availability zones or fault domains
  • Allows your application to automatically scale as resource demand changes
  • Works at large-scale

A scale set can be deployed with a Windows image or Linux image such as RHEL, CentOS, Ubuntu, or SLES.

Creating a Windows Virtual Machine Scale Set

In the Azure portal search bar, search for and select Virtual Machine Scale Sets.

Image description

Select Create on the Virtual Machine Scale Sets page.

Image description

In the Basics tab, under Project details, make sure the correct subscription is selected and create a new resource group.

Image description

Under Scale set details, enter your scale set name and select a Region that is close to your area.

Image description

Under Orchestration, select Flexible.

Image description

Under Scaling mode select Auto scaling and set up the scaling conditions.

Image description

Under Instance details, select a marketplace image for Image. Select any of the Supported Distros.

_Under Administrator account configure the admin username and set up an associated password. _

Image description

Select Next: Disks to move the disk configuration options. For this quickstart, leave the default disk configurations.

Image description

Select Next: Networking to move the networking configuration options.

On the Networking page, under Load balancing, select the Use a load balancer checkbox to put the scale set instances behind a load balancer.

Image description

In Load balancing options, select Azure load balancer.
_In Select a load balancer, select a load balancer or create a new one.

Image description

select Create new, type the name then select Create.

When done select Review + create.

Image description

After it passes validation, select Create to deploy the scale set.

Image description

Wait for deployment to finish.

Image description

Clik on Go to resources to view the deployment.

Image description

The resources deployed are shown bellow

Image description

Image description

Image description

Definition of Concepts

What is Orchestration?

Orchestration is the coordination and management of multiple computer systems, applications and/or services, stringing together multiple tasks in order to execute a larger workflow or process. These processes can consist of multiple tasks that are automated and can involve multiple systems.

The goal of orchestration is to streamline and optimize the execution of frequent, repeatable processes and thus to help easily manage complex tasks and workflows to save time, increase efficiency, and eliminate redundancies.

Types of VMSS Orchestration: Uniform and Flexible
Azure VMSS provides two types of orchestration modes: Uniform and Flexible.

Uniform Orchestration is the traditional model of managing VMs in a scale set. All instances in the set are identical, ensuring uniform performance and simplifying management.

Flexible Orchestration allows for different types of instances within the same scale set. This adds complexity to management but provides flexibility in managing heterogeneous workloads where different VM sizes may be needed.

What is Azure Load Balancer?

Load balancing refers to efficiently distributing incoming network traffic across a group of backend servers or resources.
Load balancer distributes inbound flows that arrive at the load balancer's front end to backend pool instances. These flows are according to configured load-balancing rules and health probes. The backend pool instances can be Azure Virtual Machines or instances in a Virtual Machine Scale Set.

Image description

A public load balancer can provide outbound connections for virtual machines (VMs) inside your virtual network. These connections are accomplished by translating their private IP addresses to public IP addresses. Public Load Balancers are used to load balance internet traffic to your VMs.

An internal (or private) load balancer is used where private IPs are needed at the frontend only. Internal load balancers are used to load balance traffic inside a virtual network.

Diagram depicts public and internal load balancers directing traffic to web and business tiers.

Why use Azure Load Balancer?
With Azure Load Balancer, you can scale your applications and create highly available services. Load balancer supports both inbound and outbound scenarios. Load balancer provides low latency and high throughput, and scales up to millions of flows for all TCP and UDP applications.

Key scenarios that you can accomplish using Azure Standard Load Balancer include:

  • Load balance internal and external traffic to Azure virtual machines.
  • Pass-through load balancing which results in ultra-low latnecy.
  • Increase availability by distributing resources within and across zones.
  • Configure outbound connectivity for Azure virtual machines.
  • Use health probes to monitor load-balanced resources.
  • Employ port forwarding to access virtual machines in a virtual network by public IP address and port.
  • Load balance services on multiple ports, multiple IP addresses, or both.

Azure Virtual Machine scale-in policies
A Virtual Machine Scale Set deployment can be scaled-out or scaled-in based on an array of metrics, including platform and user-defined custom metrics. While a scale-out creates new virtual machines based on the scale set model, a scale-in affects running virtual machines that may have different configurations and/or functions as the scale set workload evolves.

The scale-in policy feature provides users a way to configure the order in which virtual machines are scaled-in, by way of three scale-in configurations:

Uniform orchestration
By default, Virtual Machine Scale Set applies this policy to determine which instance(s) will be scaled in. With the Default policy, VMs are selected for scale-in in the following order:

  1. Balance virtual machines across availability zones (if the scale set is deployed in zonal configuration)
  2. Balance virtual machines across fault domains (best effort)
  3. Delete virtual machine with the highest instance ID
  4. Users don't need to specify a scale-in policy if they just want the default ordering to be followed.

Balancing across availability zones or fault domains doesn't move instances across availability zones or fault domains. The balancing is achieved through deletion of virtual machines from the unbalanced availability zones or fault domains until the distribution of virtual machines becomes balanced.

NewestVM scale-in policy
This policy will delete the newest, or most recently created virtual machine in the scale set, after balancing VMs across availability zones (for zonal deployments). Enabling this policy requires a configuration change on the Virtual Machine Scale Set model.

Image description

OldestVM scale-in policy
This policy will delete the oldest created virtual machine in the scale set, after balancing VMs across availability zones (for zonal deployments). Enabling this policy requires a configuration change on the Virtual Machine Scale Set model.

Image description

Top comments (0)