DEPLOYING A VIRTUAL MACHINE SCALE SET ON AZURE
Tags: beginners, career, cloud, azure
Published: 2024-05-08 10:42:17

**DETAILED STEPS IN DEPLOYING A VIRTUAL MACHINE SCALE SET**

Azure Virtual Machine Scale Sets let you create and manage a group of load balanced Virtual Machines (VMs). The number of VM instances can automatically increase or decrease in response to demand or a defined schedule. Scale sets allows easy creation and management of multiple VMs, it provides high availability and application resiliency by distributing VMs across availability zones or fault domains. It also allows your application to automatically scale as resource demand changes, and works at large-scale. Learn more about Virtual Machine Scale Set.

**Sign in to Azure Portal**: To create a Virtual Machine Scale Set (VMSS), you will go to the Azure portal (https://portal.azure.com) and sign in with your Azure account (Assuming you already have an account and a subscription, if not you have to create one). After signing in, your screen will display as shown below. You will then search for virtual machine scale sets in the search bar.

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


This will take you to the next page where you will open the VMSS to begin its creation.
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/znpdn4qjzymufe7ie48c.png)


In creating a VMSS, one need to determine the purpose and requirement of the scale set, size, operating system and region among others. Therefore, you will begin by filling the project details in the Basic requirements.
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lkoaypg2ubnlcra1fufi.png)


**Project Details**:
**Subscription**: Select your Azure subscription.
 
**Resource Group:** Create a new one or select an existing resource group. To create a new one, click on the “**create new**” to give name to your resource group. Resource group could also be autogenerated based on the name you asigned to your VMSS.

**Virtual Machine Scale Set Name**: Enter a unique name for your VMSS.

**Region**: Choose the region where you want to deploy your VMSS. A region refers to a specific geographical location with data centres that host infrastructure and services. Click on the drop down to select your availability options. Here I chose (Europe) UK South region. Next is availability zone. 
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/usceqxmdt74hlmygaqxy.png)

**Availability Zone**: Many Azure regions provide availability zones, which are separated groups of datacenters within a region. Availability zones are close enough to have low-latency connections to other availability zones. However, availability zones are far enough apart to reduce the likelihood that more than one will be affected by local outages or weather. Availability zones have independent power, cooling, and networking infrastructure. They're designed so that if one zone experiences an outage, then regional services, capacity, and high availability are supported by the remaining zones. They help your data stay synchronized and accessible when things go wrong. For the purpose of this project, I selected the three zones 1-3 as indicated in the screenshot above. Next is Orchestration Mode.

**Orchestration Mode**: Virtual Machines Scale Sets provide a logical grouping of platform-managed virtual machines. With scale sets, you create a virtual machine configuration model, automatically add or remove additional instances based on CPU or memory load, and automatically upgrade to the latest OS version. Scale set orchestration modes allow you to have greater control over how virtual machine instances are managed by the scale set. There are two types of orchestration mode. These are:
a.	**Uniform Orchestration**: Virtual Machine Scale Sets with Uniform orchestration use a virtual machine profile or template to scale up to desired capacity. Uniform Orchestration has the following features:
(1)	Manages virtual machines that are all based on the same configuration model.
(2)	Optimized for large-scale stateless workloads with identical instances.
(3)	Provides fault domain high availability guarantees when configured with fewer than 100 instances.
(4)	Uses identical VM instances.
(5)	Individual instances aren't compatible with the standard Azure IaaS VM API commands.

b.	**Flexible Orchestration**: With Flexible orchestration, Azure provides a unified experience across the Azure VM ecosystem. Flexible orchestration does:
(1)	Allows for a mix of virtual machines with different configurations within the same scale set.
(2)	Achieve high availability at scale with identical or multiple virtual machine types.
(3)	Offers high availability guarantees up to 1000 VMs by spreading VMs across fault domains in a region or within an Availability Zone.
(4)	Enables you to scale out your application while maintaining fault domain isolation.
(5)	Supports standard Azure IaaS VMs.
Here, we are using Uniform orchestration 

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

**Scaling Mode**:
A Virtual Machine Scale Set deployment can be scaled-out (increased) or scaled-in (reduced) 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:
a.	**Default**: Virtual Machine Scale Set will automatically use the ‘Default’ scale-in policy if there's no scale-in policy definition found on the scale set model.

b.	**NewestVM**: 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.

c.	**OldestVM**: 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.

Scaling Mode can be updated Manually or Automatically configured. Here, we will select “Autoscaling”, then we click on “Configure”. 
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qqqncqu0eqrrek2x042s.png)

**Scaling conditions**: Click on the 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/3rxs0jddxef4wx6cfhlw.png)

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

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

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

**Instance details**
**Image**: select the image of your choice, here I selected Ubuntu server.
**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/hk3a16q1vbxapjalwz8v.png)

**Administrator account**
**Authentication type**: Select Password
**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.
Then, Click “Next: Spot”
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8xfoim7tt6ur38wktkcf.png)

Leave Spot as default, then click on “**Next: Disks**” 
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/januucegzpf5c2j0ij3p.png)

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

**Os disk**
**OS disk size**: Select the size of your choice
**OS disk type**: Select the one of your choice.
**key management**: Select Platform-managed key.

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

**Networking**
**Virtual Network**: The auto generated network is recommended.
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hnn4v8c06rbfvuixon0u.png)

**Load balancing**
The term load balancing refers to the distribution of workloads across multiple computing resources. Load balancing aims to optimize resource use, maximize throughput, minimize response time, and avoid overloading any single resource. It can also improve availability by sharing a workload across redundant computing resources. Azure provides various load-balancing services that you can use to distribute your workloads across multiple computing resources. These resources include Azure Application Gateway, Azure Front Door, Azure Load Balancer, and Azure Traffic Manager.

Azure load-balancing services can be categorized along two dimensions: global versus regional and HTTP(S) versus non-HTTP(S).
**Global vs. regional**
•	**Global**: These load-balancing services distribute traffic across regional back-ends, clouds, or hybrid on-premises services. These services route end-user traffic to the closest available back-end. They also react to changes in service reliability or performance to maximize availability and performance. You can think of them as systems that load balance between application stamps, endpoints, or scale-units hosted across different regions/geographies.
•	**Regional**: These load-balancing services distribute traffic within virtual networks across virtual machines (VMs) or zonal and zone-redundant service endpoints within a region. You can think of them as systems that load balance between VMs, containers, or clusters within a region in a virtual network.
**HTTP(S) vs. non-HTTP(S)**
•	**HTTP(S)**: These load-balancing services are Layer 7 load balancers that only accept HTTP(S) traffic. They're intended for web applications or other HTTP(S) endpoints. They include features such as SSL offload, web application firewall, path-based load balancing, and session affinity.
•	**Non-HTTP(S)**: These load-balancing services can handle non-HTTP(S) traffic, and we recommend them for non web workloads.
Read more on Load Balancing

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q09y63wr9yhopaui7alb.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.
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/31vh6dy69i5vehgngcyq.png)

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

Then click on “**Next: Management**”

**Upgrade policy** 
**Upgrade mode**: select the upgrade mode of your choice.
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z9co27n1f1yxip8z4i3g.png)

Next click on “**Next: Health**”
**Health**: Select the enable application health monitoring in order to update the status of your instances. Also, select on automatic repair.
  
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/euy7o4lvts8zsjwow9fs.png)

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

You may skip “Advanced, and Tags” as these populate as defaults.
Then Click “Review + create”, after validation is passed then click “Create”.

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

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

Click on “**Go to Resources**”
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ikin35q703sxyxd5fhp.png)

You have now completed your deployment, and here is the overview of your VMSS. You may now click on “**Instances**” to confirm if your instances are running.

Here, you can confirm your instances are running.

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

When you click on the instances above, you can see the availability zones they are deployed within the location selected as shown below.
  
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vt5bydx14c2xrml9ib70.png)

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