Deploy and configure Virtual Machine Scale Sets (VMSS)

Create and configure virtual machines (VMs)

📘Microsoft Certified: Azure Administrator Associate (AZ-104)


1. What is a Virtual Machine Scale Set (VMSS)?

A Virtual Machine Scale Set (VMSS) is an Azure service that allows you to deploy and manage a group of identical virtual machines (VMs). The key points:

  • All VMs in the set are identical in configuration (OS, software, size).
  • VMSS automatically scales the number of VMs up or down depending on demand.
  • VMSS is designed for high availability and load balancing.

Why use VMSS?

  • When you have an application that gets variable traffic, like a web app or an API.
  • To handle more users during peak hours and reduce costs when traffic is low.
  • To ensure redundancy, so if one VM fails, others continue running.

2. Key Features of VMSS

  1. Automatic Scaling
    • VMSS can automatically increase (scale out) or decrease (scale in) the number of VMs.
    • Scaling can be based on metrics like:
      • CPU usage
      • Memory usage
      • Disk I/O
      • Custom metrics
  2. Load Balancing
    • VMSS integrates with Azure Load Balancer or Application Gateway to distribute traffic across all VMs.
    • This ensures that no single VM is overloaded.
  3. High Availability
    • VMs are distributed across availability zones or fault domains to reduce downtime.
  4. Uniformity
    • All VMs in the scale set are configured the same way, making updates and management easier.
  5. Integration
    • Works with Azure Autoscale, Azure Monitor, and Azure DevOps for automation and monitoring.

3. How VMSS Works in an IT Environment

Imagine you have a web application that is deployed on Azure:

  • During normal hours, only 2-3 VMs are needed.
  • During peak hours, traffic spikes, and VMSS automatically adds more VMs.
  • Once traffic reduces, VMSS removes extra VMs to save cost.
  • If one VM fails, the remaining VMs continue serving users, ensuring high availability.

Other IT uses:

  • Hosting stateless web apps (apps that don’t store data locally)
  • Running microservices in the cloud
  • Deploying large batch workloads for processing data

4. Components of a VMSS

  1. Scale Set
    • The main object that contains all VMs.
  2. VM Instances
    • Individual virtual machines within the set.
  3. Load Balancer
    • Distributes traffic across VMs.
  4. Autoscale Settings
    • Define rules for scaling in/out based on metrics.
  5. Health Probes
    • Monitor VM health and remove unhealthy VMs automatically.

5. Creating a VMSS in Azure

There are three main ways to create a VMSS:

A. Using Azure Portal

  1. Navigate to Virtual Machine Scale Sets.
  2. Click + Create.
  3. Configure:
    • Basics: Subscription, Resource Group, VMSS name, region.
    • Instances: Number of VMs to start with.
    • VM size: Standard sizes like B-series, D-series, etc.
    • OS Image: Windows or Linux.
  4. Set Scaling options:
    • Manual or Autoscale
  5. Configure Load Balancer if needed.
  6. Review + Create.

B. Using Azure CLI

az vmss create \
  --resource-group MyResourceGroup \
  --name MyScaleSet \
  --image UbuntuLTS \
  --upgrade-policy-mode automatic \
  --admin-username azureuser \
  --generate-ssh-keys

C. Using ARM Templates

  • Define the VMSS configuration in a JSON template.
  • Deploy it using Azure CLI or PowerShell.

6. Scaling VMSS

Manual Scaling

  • You decide the number of VMs.
az vmss scale --resource-group MyResourceGroup --name MyScaleSet --new-capacity 10

Autoscale

  • Azure automatically adjusts VM count based on metrics.
  • Example rule:
    • If CPU > 70% for 5 minutes, add 2 VMs.
    • If CPU < 30% for 10 minutes, remove 1 VM.

7. Updating VMSS

  1. OS Image Upgrade
    • VMSS supports rolling upgrades without downtime.
    • You can update the OS image and VMs are updated in batches.
  2. Configuration Changes
    • You can update the VM size, software, or scripts.
    • Azure automatically applies changes across all VMs in the scale set.

8. Important Exam Points for AZ-104

  • VMSS is used to deploy and manage identical VMs.
  • It provides automatic scaling, load balancing, and high availability.
  • Scaling can be manual or autoscale based on metrics.
  • VMSS integrates with Azure Load Balancer or Application Gateway.
  • You can update VMSS using rolling upgrades.
  • VMSS is ideal for stateless workloads.
  • You can create VMSS via Azure Portal, CLI, PowerShell, or ARM template.
  • VMSS supports zones and fault domains for high availability.

9. Tips to Remember for the Exam

  • VMSS ≠ Single VM – it’s always a set of VMs.
  • Autoscale rules are key – know that metrics drive scaling.
  • Rolling upgrades allow updates without downtime.
  • Integration with load balancer is important for distributing traffic.
  • Best suited for applications where multiple identical VMs are needed.

Summary:
VMSS is a powerful Azure service for managing many identical VMs efficiently, handling variable workloads automatically, ensuring high availability, and making updates easy. For the AZ-104 exam, focus on creation, scaling, load balancing, updates, and integration.

Leave a Reply

Your email address will not be published. Required fields are marked *

Buy Me a Coffee