0
0
Azurecloud~30 mins

VM Scale Sets for auto scaling in Azure - Mini Project: Build & Apply

Choose your learning style9 modes available
VM Scale Sets for Auto Scaling
📋 What You'll Learn
💡 Why This Matters
🌍 Real World
Auto scaling VM Scale Sets helps applications handle changing traffic smoothly and saves costs by running only needed resources.
💼 Career
Cloud engineers and DevOps professionals use VM Scale Sets and autoscaling to build scalable, reliable cloud applications.
Progress0 / 4 steps
1
Create the VM Scale Set resource

Create an Azure VM Scale Set resource named myScaleSet in the eastus region. Use the VM size Standard_DS1_v2 and the image UbuntuLTS. Define the scale set with a capacity of 2 instances.

Azure
Need a hint?

Use the azurerm_linux_virtual_machine_scale_set resource with the exact name myScaleSet. Set location to eastus, sku to Standard_DS1_v2, and instances to 2. Use the Ubuntu 18.04 LTS image from Canonical.

2
Add autoscale configuration variables

Create a variable called autoscale_min and set it to 2. Create another variable called autoscale_max and set it to 5. These will define the minimum and maximum number of VM instances for autoscaling.

Azure
Need a hint?

Use Terraform variable blocks named exactly autoscale_min and autoscale_max with default values 2 and 5 respectively.

3
Add autoscale rules for CPU usage

Create an autoscale setting resource named myAutoscaleSetting linked to the VM Scale Set myScaleSet. Add a rule to increase instances by 1 when average CPU percentage is above 70% for 5 minutes. Add another rule to decrease instances by 1 when average CPU percentage is below 30% for 5 minutes.

Azure
Need a hint?

Use the azurerm_monitor_autoscale_setting resource named myAutoscaleSetting. Link it to the VM Scale Set using target_resource_id. Add two rules: one to increase instances when CPU > 70%, and one to decrease when CPU < 30%. Use 5 minutes cooldowns.

4
Complete the autoscale setting with cooldown and default capacity

In the autoscale setting myAutoscaleSetting, ensure the default capacity is set to 2. Set the cooldown period for both scale actions to PT5M (5 minutes). Confirm the autoscale setting is fully configured with these values.

Azure
Need a hint?

Check that the capacity block has default = "2". Both scale_action blocks should have cooldown = "PT5M".