Creating a Load Balancer for the Instance Group
Lab Steps
Introduction
Now that the instance group has been created, you need to create a load balancer to handle the traffic to the instances inside the group. In this lab, you will create a load balancer attached to the instance group.
Â
Instructions
1. In the upper search bar, enter load balancing. Click on Load balancing:
Â
2. Click on CREATE LOAD BALANCERÂ on the displayed blade:
Â
3. Because your servers are hosting a sample website, you will create an HTTP load balancer. Click on START CONFIGURATIONÂ on the HTTP(s) Load Balancing card:
Â
4. You want to allow and handle the traffic from the internet, so leave the From Internet to my VMs or serverless services option selected, select Global HTTP(S) Load Balancer (classic), and click CONTINUE:
Â
5. Enter ca-lab-load-balancer as the load balancer's name.
Â
6. Under Frontend configuration, enter ca-lab-frontend-configuration as the Name:
Note: The frontend is the way the load balancer exposes itself. So, in this case it is exposed using an IP address, and it gets HTTP requests made on port 80.
Â
7. Click DONE.
Â
8. Click Backend configuration, click the Backend services & backend buckets drop-down, and click CREATE A BACKEND SERVICE:
Â
7. Fill the displayed form as described below (leave the unmentioned fields at their default value):
- Name:Â ca-lab-backend-service
- Instance group: Select ca-lab-instance-group
- Port numbers: 80
- Cloud CDN: Uncheck Enable Cloud CDN
- Health check: CREATE A HEALTH CHECK
- Enter ca-lab-health-check as Name and click SAVE.
- Logging: Ensure Enable logging is unchecked
- Click CREATE.
Note: The backend service represents the GCP resources where the load balancer is going to direct the traffic to. So, in this case, the backend service is the instance group you created earlier.
Â
8. Click on CREATE.
Â
9. After a few seconds, you will see the load balancer ready:
Warning: If the spinner doesn't complete, click on the Refresh button.
Â
Summary
In this lab, you created a load balancer attached to the instance group.
Check that the load balancer has been created.