Azure VMSS Contd..
- Virtual Machine Scale Set (VMSS) is a compute resource that can be use to deploy and manage a set of identical virtual machines.
- By default VMSS supports upto 100 instances, However it is possible to create upto 1000 instances by placing instances in multiple placement groups.
- How can two virtual machine be identical?
- Generally in VMSS we would have vm with our application running in it, so we need to create a VM Image which has our application preinstalled and configured in it.
Building an VM Image
- Lets create an ubuntu 20.04 server
- Login into the server and install apache server with php modules
sudo apt update sudo apt install apache2 -y sudo apt install php libapache2-mod-php php-mysql -y echo '<?php phpinfo(); ?>' | sudo tee /var/www/html/info.php sudo systemctl restart apache2
- Now navigate to the public ip
- We can use any of the available metrics for scaling
- Now, in the case of virtual machine scale sets we need to use metrics, so artifically create load on the virtual machine using a tool stress, where we increase stress on cpu, ram , disk and use the metric for enabling the scale up or down
sudo apt install stress -y
* Azure VM Image is a snapshot of a disk (compressed backup of disk) with user information removed and some metadata.
* To create a VM Image we need to remove the user information and after that the vm which we created becomes unusable as there is no user in it. so generally after creating a reusable vm image we delete this vm.