How to Create a Virtual Machine Scale Set in Azure.
Published: 2024-05-01 22:43:34

**What is virtual machine scale set?**

A Virtual Machine Scale Set allows you to deploy and manage a set of autoscaling virtual machines. You can scale the number of VMs in the scale set manually, or define rules to auto scale based on resource usage like CPU, memory demand, or network traffic. You can use VMSS to deploy a group of VMs with identical configurations, such as the operating system, its also provides load balancing.

**Create Virtual Machine Scale Set**

You can deploy a scale set with a Windows Server image or Linux image.
Lets begin!!!

1) Type Scale set in the search box.
In the results, select Virtual Machine Scale Sets. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iunfdhnjmulfu2lg12uj.png)



2) Click Create on the Virtual Machine Scale Sets page, which opens the Create a Virtual Machine Scale Set page.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/izah58q4k0lrpuqxjzel.png)


In the Basics tab, under Project details, 
**Subscription:** Select the right subscription
**Resource group:** select your resource group or you create new resource group.

**Scale set details**

**Virtual machine scale set name:** Type the name for your virtual machine scale set.
**Region:** select a region that is close to your area.
**Availability zone:** Select all he zones make your V.machine highly available.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dbd1eoouknfuppizmvwm.png)


**Orchestration**
There are two types of orchestration modes in Azure: Uniform and Flexible.

**Uniform Orchestration**

- Manages virtual machines that are all based on the same configuration model.
- Optimized for large-scale stateless workloads with identical instances.
- Provides fault domain high availability guarantees when configured with fewer than 100 instances.
- Uses identical VM instances.
- Individual instances aren't compatible with the standard Azure IaaS VM API commands.

**Flexible Orchestration**
- Allows for a mix of virtual machines with different configurations within the same scale set.
- Achieve high availability at scale with identical or multiple virtual machine types.
- Offers high availability guarantees (up to 1000 VMs) by spreading VMs across fault domains in a region or within an Availability Zone.
- Enables you to scale out your application while maintaining fault domain isolation.
- Supports standard Azure IaaS VMs, instead of scale set child virtual machines.

 **Virtual machine scale set name:** ensure the Uniform option is selected.

**Scaling**
**Scaling mode:** select autoscaling (Autoscaling: Scaling based on a CPU metric, on any schedule.)
**Scaling configuration:** click configure, in the scaling configuration make the necessary configuration and click save.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iixawuorktiz6i4dbc8a.png)

**Scaling conditions:** Click on he add scaling condition or the pen icon to make necessary scaling of your choice and save.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hukiu3dthfp4jfwmrxdb.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ygmzigtryo42rdev9oqn.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y556m1akectwvahp9jnm.png)



**Instance details**
**Image:** select the image of your choice.
**VM architecture:** select x64 as it provides most software compatibility.
**size:** select the size of your choice.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5vprsma6yhjdt7cnfvuq.png)


**Administrator account**
 **Username:** type in your username.
**Password:** enter your desire password.
**Confirm password:**  re-enter your desire password. 
**license type:** select the license type and select the box.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q8d3pjfojczqeo889z2q.png)


**DISK**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kqjyw4nmk0jq1i4hz2dw.png)

**OS disk size:** select the size of your choice
**OS disk type:** select the one of your choice.
**key management:** select platform-managed key.

**Networking**
**Under Load balancing**
**Load balancing options:** select Azure load balancer.
**select load balancer:** create a load balancer if you don't have an existing one.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/snljh5ik8p4riks33ccy.png)

**create a load balancer**
Load balancer help to distribute traffic across your virtual machine. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jyktqmf2tx304p1eqliy.png)

**Load balancer name:** enter the name of your choice.
**type:** select the one of your choice and leave others at default then select create.

**Management**
**under upgrade policy**
**upgrade mode:**  select the upgrade mode of your choice.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wirc82h349yvu61r598l.png)

**Health**
Enable application health monitoring in other to update the status of your instances.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vnpmarlygkijkltjs5tk.png)

- Click review + create, after validation is passed then click create.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6kxru8b2hgtxwxfe6hft.png)

perfect!!! my vmss are up and running.

**Difference between scaling mode and scale-in policy configuration**

In the context of cloud computing and virtual machine scale sets, scaling mode and scale-in policy configuration are two distinct concepts that manage how resources are adjusted to meet demand.

**Scaling Mode:**

Scaling mode refers to the overall behavior of a virtual machine scale set when it comes to adding or removing instances.
It’s about how and when the scale set decides to increase or decrease the number of virtual machines.

**Scale-In Policy Configuration:**

Scale-in policy, on the other hand, is a subset of the scaling mode that specifically deals with the removal of instances.
It defines the order and criteria for which virtual machines are terminated during a scale-in event.
Azure, for instance, provides three scale-in policies: Default, NewestVM, and OldestVM2.
Default: Balances VMs across availability zones and selects the oldest VM for termination.
NewestVM: Targets the most recently created VM for termination after balancing across zones.
OldestVM: Removes the oldest VM after balancing across zones.

**load  balancer**
 what is load balancer? 
A load balancer is a system that distributes incoming network traffic across a group of backend servers or resources.

**At what point do we need to enable a load balancer?**

In essence, you should consider enabling an Azure Load Balancer when your application demands reliability, scalability, and better performance under varying loads, or when you are deploying services that span multiple virtual machines, availability zones, or regions.