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 Balancer to Distribute Application Network Traffic to an Application

Your team needs you to create an environment with two servers in a target pool to serve up application traffic that is being distributed through a load balancer. Your task, once you set up your environment, is to use the load balancer's IP address to make sure that both servers in your target pool are serving the application traffic. Good luck!

Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 15m
Published
Clock icon Mar 25, 2022

Contact sales

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

Table of Contents

  1. Challenge

    Create Two Instances to Serve as Your Target Pool

    INSTANCE 1

    • Go to Compute Engine to create instance:
      • Name: acloud-1
      • Region: us-central1
      • Zone: us-central1-b
      • OS image Debian GNU/Linux
    • Add a networking tag of acloud-tag.
    • Paste this startup script:
      #! /bin/bash
      sudo apt-get update
      sudo apt-get install apache2 -y
      sudo service apache2 restart
      echo '<!doctypehtml><html><body><h1>acloud1</h1></body></html>' | tee /var/www/html/index.html
      

    INSTANCE 2

    • Go to Compute Engine to create instance:
      • Name: acloud-2
      • Region: us-central1
      • Zone: us-central1-b
      • OS image Debian GNU/Linux
    • Add a networking tag of acloud-tag.
    • Paste this startup script:
      #! /bin/bash
      sudo apt-get update
      sudo apt-get install apache2 -y
      sudo service apache2 restart
      echo '<!doctypehtml><html><body><h1>acloud2</h1></body></html>' | tee /var/www/html/index.html
      
  2. Challenge

    Add Firewall Rule

    • Create firewall rule:

    • Name: acloud-firewall Targets: Specified target tags Target tags: acloud-tag Source filter: IPv4 ranges

    • Set the Source IPv4 ranges to 0.0.0.0/0, which allows traffic from any source.

    • For specified protocols and ports, select TCP and enter 80.

      NOTE: It may take a few minutes for the Console to display the new firewall rule or refresh to see the rule.

  3. Challenge

    Create the Load Balancer

    1. Click the Navigation menu, located in the top left-hand side.
    2. Select Network services > Load balancing.
    3. Click Create Load Balancer.
    4. Click Start Configuration for the TCP Load Balancing option.
    5. Select From Internet to my VMs.
    6. Select Single region only.
    7. Select Target Pool or Target Instance.
    8. Click Continue.
    9. Enter the following information: Name: acloud-lb Region: us-central1 (Iowa)
    10. Select Backend configuration.
    11. Click Select Existing Instances.
    12. For VM instances, select acloud-1(us-central1-b) and acloud-2(us-central1-b). Click OK.
    13. Select Frontend configuration.
    14. For Name, enter acloud-fe.
    15. For IP address, select Create IP Address.
    16. In the Reserve a new static IP address dialog, enter acloud-ip for the Name.
    17. Click Reserve.
    18. For Port, enter 80.
    19. Click Done.
    20. Click Review and finalize (optional).
    21. Click Create.
    22. Click the acloud-lb, then choose EDIT.
    23. Under the Backend configuration in the Health check section, choose CREATE A HEALTH CHECK.
    24. Enter the following information: Name: health Protocol: HTTP Port: 80.
    25. Keep the given defaults for Health criteria.
    26. Click Save.
    27. Click UPDATE.
    28. Click UPDATE LOAD BALANCER
  4. Challenge

    Send Traffic to Your Instances

    • Copy the IP address and place it in the URL, you will then see either acloud-1 or acloud-2 displayed. This will confirm your traffic is being served the instance webpages.
    • Open Cloud Shell and execute command while true; do curl -m1 IP_ADDRESS; done. This will show that both of your servers are serving the application traffic to your end users.

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