Virtual Machine Scale Set, an interesting service offered by Microsoft Azure, helps to create and manage a group of identical, load balancer Virtual Machines (VMs). The number of VM instances can automatically increase or decrease based on scheduled conditions.
Scale Sets are used to run multiple instances of an application and even if a problem arises, the customers can continue to access the application through one of the other instances with minimal interruption. Thus, Scale Sets provide high availability to your applications, and allow you to centrally manage, configure, and update many VMs.
We can also use the Availability Zone to automatically distribute VM instances in a Scale Set with a single datacenter or across multiple datacenters. With the help of Virtual Machine Scale Sets, we can build large-scale services for areas such as compute, big data, and container workloads. A Scale Set can have around 0 to 1000 VMs based on platform images and around 0 to 600 VMs based on custom images.
Difference between Virtual Machine and Virtual Machine Scale Set
- It is true that Scale Sets are built from VMs. If we want to add additional VM instances, VM Scale Sets automatically create it from central configuration, traffic balancing and distribution, high availability and redundancy and scaling of VM whereas for normal virtual machine all these are manual processes.
- For scaling of VMs we need to manually monitor and use Azure automation whereas for Virtual Machine Scale Set, auto scale is based on host metrics, in-guest metrics, Application Insights and schedule.
Best Way to reduce cost when you go with VMSS
It is said that Virtual Machine Scale Set is costly but there are ways to optimize the cost. If you are just testing, deploy VMSS with no auto scale. For the dev environment we can use VMSS with auto-scale with general purpose VMs and finally for production environment we can go with a combination of Low Priority and General purpose VMs, and auto Scale. We only need to pay for the underlying compute resources such as the VM instances, load balancer, or Managed Disk storage. The management and automation features, such as auto scale and redundancy, incur no additional charges over the use of VMs.
How to create Virtual Machine Scale Set from Azure Portal:1. First, login to your Azure portal and select Create Resources and search for Virtual Machine Scale Set. A page similar to the one shown below will appear.
2. Click on ‘Create’. A page similar to the one shown below will appear. Fill in the required details:
- Give the Virtual Machine Scale Set a name.
- Select Operating system disk image. You can select private or public images as per your requirement.
- Select your Subscription name.
- Create new or existing Resource group.
- Give the Location where you need to create the VMMS.
- You can select Availability Zone as per the requirement.
- Enter username, password and confirm password.
- Select instance count and size as per requirement.
- Click on ‘Use managed disks’ option.
- Auto scale can be either Disabled or Enabled
- We can choose Load balancing options as per the requirement.
- In Management we need to opt for Boot diagnostics and choose its storage account.
- Now click on Create. Your VMMS will be created as shown below:
VMSS real world best practices which we can follow:
- We should use DevOps to deploy images on Virtual Machine Scale Set, a process made easier with the help of packer tool
- For hosting any web-based app, VMSS should be our default choice because scaling is easy and automatically done as we schedule the conditions
- Always deploy a dedicated subnet for VMSS
- We should use PaaS DB offerings with Virtual Machine Scale Set, and should not go with VMSS to host DB
- We should use Azure ARM Script to deploy VMSS as it offers more flexibility and control
- For DR we should deploy another set of VMSS in cross region or cross zone. The DR should always be Active-Active and not Active-Passive
- We should create base images with web servers and for code changes we can use Azure File share for all VMSS VMs
- We can use PowerShell or Azure CLI for updating the applications
- We should not do backup for Virtual Machine Scale Set
- We should not login to the VM unless it is necessary