Deploy and Configure VM Scale Sets (VMSS) in the Azure Portal
In the previous article, we have configured an availability set with Azure Load balancer where we configured everything manually for Availability Set. In this article, we are deploying and configuring VM Scale Sets which use Auto scale based on predefined metrics. Adding and removing VMs automatically based on predefined metrics. You control what metrics to monitor, such as CPU or disk, how long the application load must meet a given threshold, and how many VM instances to add to the scale set. Apart from this, you do not have to manually configure Azure Load Balancer; VMSS automatically create and integrate with Azure Load Balancer or Application Gateway and automatic distribution of VMs instances across Availability Sets or Availability Zones. According to Microsoft definition, “Azure virtual machine scale sets let you create and manage a group of identical, load balanced VMs. The number of VM instances can automatically increase or decrease in response to demand or a defined schedule. Scale sets provide high availability to your applications, and allow you to centrally manage, configure, and update a large number of VMs. With virtual machine scale sets, you can build large-scale services for areas such as compute, big data, and container workloads.”
- Easy to create and manage multiple VMs
- Provides high availability and application resiliency
- Allows your application to automatically scale as resource demand changes
- Works at large-scale
Use the following steps to deploy and configure VM Scale Sets (VMSS) in the Azure Portal:
1. In the Azure Portal, click on + Create a resource. In the New search box type scale set and then choose Virtual machine scale set.
2. On the Virtual machine scale set page, click on Create button.
3. On the Create virtual machine scale set page, provide the following values:
BASICS
Virtual machine scale set name: MSSERVERPROVMSS
Operating system disk image: Windows Server 2016 Datacenter
Resource group: MSSERVERPRO-ASA-RG01
Location: Southeast Asia
Username: ktmadmin
INSTANCES
Instance count: 2
Instance size: Standard DS1 v2
Deploy as low priority: Yes
Use managed disks: Yes
AUTOSCALE
Autoscale: Enabled
Minimum number of VMs: 2
Maximum number of VMs: 5
Scale Out
CPU threshold: 75
Number of VMs to increase by: 1
Scale in
CPU threshold: 25
Number of VMs to decrease by: 1
NETWORKING
Choose Load balancing options: Load balancer
Public IP address name: MSSERVERPRO-LB-PIP
Domain name label: msserveprolb
CONFIGURE VIRTUAL NETWORKS
Virtual network: MSSERVERPRO-ASA-VN01
Subnet: FrontEnd-Subnet (10.1.4.0/24)
Public IP address per Instance: Off
To confirm the scale set options, click on Create button.
4. VMSS … Your deployment is underway……
5. After couple of minutes, VMSS…. Your deployment is complete ……
6. On the Notifications, click on Go to resource.
7. On the Virtual machine scale set Overview page, verify Public IP address and Autoscaling status is On.
8. Verify that previously configured auto scaling Instance limits and Scale Rules. You can also modify the existing rules later.
9. Go to Load balancer Overview page, copy the Public IP address.
10. On the Load balancer page, expand settings, click on Frontend IP configuration, and note down LoadbalancerFrontEnd IP address.
11. On the Backend pools, 2 virtual machines instances are running…because we select 2 Instance count during creating virtual machine scale set configuration.
12. Verify Health probes.
13. Verify that Load balancer rules has created.
Connect to a VM in the scale set:
When you create a scale set in the portal, a load balancer is created. Network Address Translation (NAT) rules are used to distribute traffic to the scale set instances for remote connectivity such as RDP or SSH.
To view these NAT rules and connection information for your scale set instances:
1..From the list of resources, select your Load balancer, such as MSSERVERPROVMSSlb. Choose Inbound NAT rules to view NAT rules and connection information of scale set instances.
You can connect to each VM in the scale set using these NAT rules. Each VM instance lists a destination IP address and TCP port value. For example, if the destination IP address is 40.65.173.201and the TCP port is 50000, you connect to the VM instance as follows:
For a Windows scale set, connect to the VM instances using RDP use IP address appended with TCP port.
- For instance 1 connect to RDP, use 40.65.173.201:50000
- For instance 2 connect to RDP, use 40.65.173.201:50001
For a Linux scale set, connect to the VM instance with SSH on ssh
- azureuser@40.65.173.201 –p 50000
When prompted, enter the credentials you specified from the previous step when you created the scale set. The scale set instances are regular VMs that you can interact with as normal.
Summary:
I hope this article helps in deploying VM Scale Set (VMSS). VMSS allows you to deploy and manage a set of identical, auto-scaling virtual machines. You can scale the number of VMs in the scale set manually, or define rule to autoscale based on resource usage like CPU, memory demand, or network traffic. During VMSS deployment, Azure Load balancer is created automatically and Azure Auto scaling is added with a virtual network and a public IP address. Virtual machines in the scale set are not allowed with public IP address.
Sir, Can you create scale set with application gateway. I want to create auto scaled scaleset with application gateway. Can you create a tutorial.
Also, Is it possible to get azure cloud subscription in Nepal?
I could not create NAT rules for VM Scaleset from Azure Portal. The target VM option is not visible when new NAT rule is created for a VM instance in VMSS.
So I created through powershell and I could see it in Azure Resource Explorer, however not visible in Azure portal.
Also unable to remote connect VM instance using the public load balacer’s public ip address.
What am I missing?
Ola,
How to set the memory-based automatic scaling rule in Azure VMSS ?
How Can I Create an aplication with redundancy in scale sets if one instance is not working
other instance start working with load balancer? in linux and windows ?