Skip to content

Contact sales

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

Creating a Load-Balanced Managed Instance Group on Google Cloud Platform

In this hands-on lab, we are going to experience creating a managed instance group using an instance template, creating an HTTP load balancer to act as the instance group frontend, and then updating our instance group from a 'version 1' to 'version 2' website.

Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 0m
Published
Clock icon May 24, 2019

Contact sales

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

Table of Contents

  1. Challenge

    Create Custom Images from Our Initial Machines

    Upon logging into the Google Cloud Platform, navigate to Compute Engine and stop the currently running instances. Utilize Cloud Shell to quickly create two custom images using the following commands:

     gcloud compute images create web-v1 --family=webserver --source-disk=web-1 --source-disk-zone=us-central1-a
    
    gcloud compute images create web-v2 --family=webserver --source-disk=web-2 --source-disk-zone=us-central1-a
    

    Once the images have created, verify they were created by navigating to the Images menu on the lefthand side.

  2. Challenge

    Create an Instance Template for webv1

    Create an Instance Template using the custom image for webv1. The Instance Template should be of Machine Type e2-micro. Additionally, ensure the Firewall is configured to allow HTTP traffic.

  3. Challenge

    Create a Managed Instance Group

    Create a Managed Instance Group called web-group with the following parameters:

    • Location: Single zone in us-central1
    • Instance Template: instance-template-1
    • Autoscaling: Minimum Number of Instances set to 3. Maximum number of instances set to 5

    Additionally, create a Health Check that monitors TCP on port 80.

  4. Challenge

    Create a Load Balancer

    • Create an HTTP(S) Load Balancer that accepts connections from the internet.
    • For the Frontend configruation, ensure the protocol is set to TCP on port 80.
    • For the Backend, set the type to instance groups and select the web-group instance group.
    • Apply the same Health Check created earlied to the backend.
  5. Challenge

    View the Load Balanced Website

    Once the Load Balancer has been provisioned, navigate to the Frontend tab and copy the IP address. Open this up in a new tab and observe the website loading is Version 1.

  6. Challenge

    Update the Instance Group to the Version 2 Website

    Create a new Instance Template using the webv2 custom image with the same parameters from the webv1 template. Once the template has been created, modify the Instance Group to use the new Instance Template and update the VMs. Make sure the Temporary additional instances and Maximum unavailable instances to 1.

    After the change has started, observe the process in the console and begin refreshing the website and observe the change to version 2. You'll also notice the version 1 website is still showing up until all servers have been swapped to version 2.

    Note: The whole process will take about 15 minutes.

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