Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Azure icon
Labs

Deploy an Azure VM Scale Set with Load Balancing

Welcome to the Deploy a VM Scale Set with Load Balancing lab. In this lab, we will cover three objectives: 1. Use an existing subnet as a data source 1. Create and configure an Azure load balancer 1. Create and configure an Azure VM Scale Set By the end of this lab, you will have created an Azure VM Scale Set and load balancer using Terraform and a module from the public registry.

Azure icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 45m
Published
Clock icon May 02, 2024

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Use an Existing Subnet as a Data Source

    In this objective, you'll add a existing Azure subnet as a data source to your Terraform configuration. This subnet will be used for the network interfaces of the VM Scale Set.

    1. Log into the Azure CLI using the provided credentials
    2. Retrive the name of the provided resource group and virtual network.
    3. Create a new Terraform configuration using the azurerm.
    4. Set skip_provider_registration to true for the azurerm provider block.
    5. Create data sources for the existing resource group and subnet named web.
    6. Create the necessary input variables and terraform.tfvars file.
    7. Add an output to display the subnet ID.
    8. Deploy the configuration and verify the correct output is displayed in the terminal.
  2. Challenge

    Create and Configure an Azure Load Balancer

    In this objective, you will add a public-facing Azure load balancer using the module from the public registry. The load balancer should listen on port 80 for traffic and send it to the application port defined for the VM Scale Set. The health probe should sent an HTTP request to the "/" path on the application port defined for the VM Scale Set.

    1. Add the load balancer module to your configuration using the existing resource group provided by the lab, with the following values:
      • type = "public"
      • pip_sku = "Standard"
      • allocation_method = "Static"
      • lb_sku = "Standard"
    2. Add an lb_port entry listening on port 80 and sending traffic to the defined application port.
    3. Add an lb_probe entry the checks the path "/" on the defined application port.
    4. Validate and deploy the configuration.
  3. Challenge

    Create and configure an Azure VM Scale Set

    In this objective, you will add an Azure VM Scale Set and network security group to the configuration using the provided subnet and startup script. The network security group should allow traffic from anywhere on the defined application port.

    1. Add an azurerm_network_security_group and azurerm_network_security_rule to the configuration. The rule should allow TCP traffic from any source address and port to the defined application port of the VM Scale Set.
    2. Add a TLS private key for the VM Scale Set configuration.
    3. Add a custom_data.tpl file with the linked contents from the course repository.
    4. Add an azurerm_linux_virtual_machine_scale_set resource to your configuration using the following values:
      • publisher = "Canonical"
      • offer = "0001-com-ubuntu-server-jammy"
      • sku = "22_04-lts"
      • version = "latest"
    5. Include a reference to the network security group and load balancer backend pool in the network_interface block.
    6. Include the health_probe_id argument referring to the health probe created by the load balancer module.
    7. Add the necessary input variables to the variables.tf file and add the values to the terraform.tfvars file.
    8. Add an output for the public IP address of the load balancer.
    9. Validate and deploy the configuration.
    10. Verify that you can reach the website at the public IP address and port.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

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.

Start learning by doing today

View Plans