Azure Virtual Machine Scaleset (VMSS)
- Virtual machine scaleset allows to perform automatic horizontal scaling based on metrics such as cpu, network, memory or even custom metrics
- To Create a virtual machine scaleset we need a image. Here we have two choices, use
- OS image
- Custom image with application preinstalled
- Using Custom image is widely adopted option.
- We will be creating a VMSS using the image which we stored in compute gallery

- Refer Here for official docs
- Refer Here for quick start
- We have create a vmss with
- scale condition: when average
cpu utilization > 90 %for last 5 minutes increase 1 vms and when averagecpu utilization < 50%for last 5 mins decrease 1 vm - min vms 1
- max vms 5
- No loadbalancer
- Selected public ip for each vm





- scale condition: when average
- To scale these machines the condition is cpu utilization should be greater than 90% for 5 minutes.
- To put artifical load on cpu lets use the stress tool
# login into vm and execute the following command
stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 15m -v
- we have observed the number of vms increased and decreased based on dynamic metrics.
Virtual Machine Image Auto Upgrade
- The goal of this activity is to check if the vm image update to the compute gallery image definition will deploy into vmss
-
Details
- We have a version 1.0.0 where vmss was created
- Now we have a new release 1.1.0. When we have a new release how will vmss handle this
- Lets have a gallery with some image defintion at version 1.0.0.
- Create a vmss with this image
- Now add one more version of the vm image
1.0.1to the gallery and wait for the vmimage to be deployed to vmss - Note:
- Try using any html website templates and copy that to /var/www/html to give a better look and feel
- Next steps:
- Create a vmss with version 1.0.0
- ensure you are able to access application using load balancer
- Now create a new latest version and wait for web pages to be loaded.
