- Lab
- A Cloud Guru
Configure a Load Balanced VM Scale Set in Azure
Welcome to this Azure hands-on lab, where we will be creating and configuring a Load Balanced Virtual Machine Scale Set (VMSS). The goal of this lesson is to gain knowledge and experience with dynamic and elastic compute using a VMSS and high availability using a load balancer. Good luck, and enjoy the hands-on lab!
Path Info
Table of Contents
-
Challenge
Create a VM Scale Set with Load Balancing
- Create a VM Scale Set with the following properties:
- Basics:
- Virtual machine scale set name: vmscaleset01
- Location: West US
- Availability zone: None
- Operating system disk image: Ubuntu Server 20.04 LTS
- Azure Spot instance: No
- Instance size: *Standard_D2s_v3
- Authentication type: Password
- Username: azureuser
- Password: Use the password you have been provided in the credentials section
- Disks:
- OS disk type: Standard SSD
- Encryption type: Default
- Networking:
- Virtual network: vnet1 (Use the existing vnet available in the resource group provided for you).
- Subnet: subnet1
- NIC network security group: None (we already have one attached to the subnet)
- Public IP address: Enabled
- Use a load balancer: Yes
- Load balancing options: Azure load balancer
- Virtual network: vnet1 (Use the existing vnet available in the resource group provided for you).
- Scaling:
- Initial instance count: 0 (we will change this later)
- Scaling policy: Manual (we will change this later)
Note that there can be an error with the Azure Portal, which results in the Manual Scale being set to 2 instead of 0.
Make sure you change this to 0 before proceeding.
- Configure an outbound rule to enable the virtual machines to connect to the Internet and download any required software.
-
Challenge
Configure a Custom Script Extension
- Store the following script in the provided storage account: https://github.com/linuxacademy/content-az300-lbvmscaleset/blob/master/script.sh
- Configure the script as a Custom Script Extension for the VM Scale Set.
-
Challenge
Configure Autoscale
- Configure Custom autoscale, with the following properties:
- Name:
autoscalesetting01
. - Configure the 'Default' autoscale profile:
- Scale based on a metric selected
- Click 'Add a rule', to add a rule for scaling out:
- Scale based on the VM Scale Set
- Criteria: average percentage CPU, greater than 70% over 5 minutes
- Increase by 1 instance and 5 minute cool down
- Add a rule for scaling in:
- Scale based on VM Scale Set
- Criteria: average percentage CPU, less than 10% over 5 minutes
- Decrease by 1 instance
- Configure instance limits: minimum of 1, maximum of 3, and default of 1.
- Click 'Add a rule', to add a rule for scaling out:
- Scale based on a metric selected
-
To stress the CPU in the virtual machine, use the following command:
az vm run-command invoke -g <TAB complete> -n <TAB complete> --command-id RunShellScript --scripts "stress --cpu 8"
Watch the monitoring of the VMSS and confirm that your instance count increases.
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.