Dieser Inhalt ist noch nicht für Mobilgeräte optimiert.
Die Lernumgebung funktioniert am besten, wenn Sie auf einem Computer über einen per E‑Mail gesendeten Link darauf zugreifen.
Overview
In this hands-on lab, you'll learn the differences between a network load balancer and a HTTP load balancer, and how to set them up for your applications running on Google Compute Engine virtual machines.
Students are encouraged to type the commands themselves, which helps in learning the core concepts. Many labs include a code block that contains the required commands. You can easily copy and paste the commands from the code block into the appropriate places during the lab.
What you'll do
Setup a network load balancer.
Setup a HTTP(s) load balancer.
Get hands-on experience learning the differences between network load balancers and HTTP load balancers.
Prerequisites
Familiarity with standard Linux text editors such as vim, emacs, or nano is helpful.
Setup
For each lab, you get a new Google Cloud project and set of resources for a fixed time at no cost.
Sign in to Google Skills using an incognito window.
Note the lab's access time (for example, 1:15:00), and make sure you can finish within that time.
There is no pause feature. You can restart if needed, but you have to start at the beginning.
When ready, click Start lab.
Note your lab credentials (Username and Password). You will use them to sign in to the Google Cloud Console.
Click Open Google Console.
Click Use another account and copy/paste credentials for this lab into the prompts.
If you use other credentials, you'll receive errors or incur charges.
Accept the terms and skip the recovery resource page.
Activate Google Cloud Shell
Google Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud.
Google Cloud Shell provides command-line access to your Google Cloud resources.
In Cloud console, on the top right toolbar, click the Open Cloud Shell button.
Click Continue.
It takes a few moments to provision and connect to the environment. When you are connected, you are already authenticated, and the project is set to your PROJECT_ID. For example:
gcloud is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.
You can list the active account name with this command:
[core]
project = qwiklabs-gcp-44776a13dea667a6
Note:
Full documentation of gcloud is available in the
gcloud CLI overview guide
.
Task 1. Set the default region and zone for all resources
In Cloud Shell, set the default zone:
gcloud config set compute/zone us-central1-a
Set the default region:
gcloud config set compute/region us-central1
Note: Learn more about choosing zones and regions from the Regions and zones guide.Note: When you run gcloud on your own machine, the config settings persist across sessions. In Cloud Shell you need to set this for every new session or reconnection.
Task 2. Create multiple web server instances
To simulate serving from a cluster of machines, create a simple cluster of Nginx web servers to serve static content using Instance Templates and Managed Instance Groups.
Instance Templates define the look of every virtual machine in the cluster (disk, CPUs, memory, etc). Managed Instance Groups instantiate a number of virtual machine instances using the Instance Template.
To create the Nginx web server clusters, create the following:
A startup script to be used by every virtual machine instance to set up a Nginx server upon startup.
An instance template to use the startup script.
A target pool.
A managed instance group using the instance template.
Still in Cloud Shell, create a startup script to be used by every virtual machine instance. This script sets up the Nginx server upon startup:
Created [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-03-f120f3ff8d59/global/instanceTemplates/nginx-template].
NAME: nginx-template
MACHINE_TYPE: n1-standard-1
PREEMPTIBLE:
CREATION_TIMESTAMP: 2022-08-01T10:18:34.010-07:00
Create a target pool. A target pool allows a single access point to all the instances in a group and is necessary for load balancing in the future steps:
gcloud compute target-pools create nginx-pool
Output:
Created [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-03-f120f3ff8d59/regions/us-central1/targetPools/nginx-pool].
NAME: nginx-pool
REGION: us-central1
SESSION_AFFINITY: NONE
BACKUP:
HEALTH_CHECKS:
Create a managed instance group using the instance template:
You should be able to connect to each of the instances via their external IP addresses via http://EXTERNAL_IP/ shown as the result of running the previous command.
Check your lab progress. Click Check my progress below to verify that you've created a group of webservers.
Create a group of webservers
Task 3. Create a network load balancer
Network load balancing allows you to balance the load of your systems based on incoming IP protocol data, such as address, port, and protocol type. You also get some options that are not available, with HTTP(S) load balancing. For example, you can load balance additional TCP/UDP-based protocols such as SMTP traffic. And if your application is interested in TCP-connection-related characteristics, network load balancing allows your app to inspect the packets, where HTTP(S) load balancing does not.
You can then visit the load balancer from the browser http://IP_ADDRESS/ where IP_ADDRESS is the address shown as the result of running the previous command.
Check your lab progress. Click Check my progress below to verify that you've created an L4 Network Load Balancer that points to the webservers.
Create an L4 Network Load Balancer that points to the webservers
Task 4. Create a HTTP(s) load balancer
HTTP(S) load balancing provides global load balancing for HTTP(S) requests destined for your instances. You can configure URL rules that route some URLs to one set of instances and route other URLs to other instances. Requests are always routed to the instance group that is closest to the user, provided that group has enough capacity and is appropriate for the request. If the closest group does not have enough capacity, the request is sent to the closest group that does have capacity.
Created [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-03-f120f3ff8d59/global/httpHealthChecks/http-basic-check].
NAME: http-basic-check
HOST:
PORT: 80
REQUEST_PATH: /
Define an HTTP service and map a port name to the relevant port for the instance group. Now the load balancing service can forward traffic to the named port.
Created [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-03-f120f3ff8d59/global/urlMaps/web-map].
NAME: web-map
DEFAULT_SERVICE: backendServices/nginx-backend
Note: To direct traffic to different instances based on the URL being requested, review the Request routing to a multi-region external HTTPS load balancer guide.
Create a target HTTP proxy to route requests to your URL map:
Created [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-03-f120f3ff8d59/global/targetHttpProxies/http-lb-proxy].
NAME: http-lb-proxy
URL_MAP: web-map
Create a global forwarding rule to handle and route incoming requests. A forwarding rule sends traffic to a specific target HTTP or HTTPS proxy depending on the IP address, IP protocol, and port specified. The global forwarding rule does not support multiple ports:
Take note of the http-content-rule IP_ADDRESS for the forwarding rule.
From the browser, you should be able to connect to http://IP_ADDRESS/. It may take three to five minutes. If you do not connect, wait a minute then reload the browser.
Check your lab progress. Click Check my progress below to verify that you've created an L7 HTTP(S) Load Balancer.
Create an L7 HTTP(S) Load Balancer
Task 5. Test your knowledge
Test your knowledge about Google cloud Platform by taking our quiz. (Please select multiple correct options if necessary.)
End your lab
When you have completed your lab, click End Lab. Google Skills removes the resources you’ve used and cleans the account for you.
You will be given an opportunity to rate the lab experience. Select the applicable number of stars, type a comment, and then click Submit.
The number of stars indicates the following:
1 star = Very dissatisfied
2 stars = Dissatisfied
3 stars = Neutral
4 stars = Satisfied
5 stars = Very satisfied
You can close the dialog box if you don't want to provide feedback.
For feedback, suggestions, or corrections, please use the Support tab.
Copyright 2026 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
Labs erstellen ein Google Cloud-Projekt und Ressourcen für einen bestimmten Zeitraum
Labs haben ein Zeitlimit und keine Pausenfunktion. Wenn Sie das Lab beenden, müssen Sie von vorne beginnen.
Klicken Sie links oben auf dem Bildschirm auf Lab starten, um zu beginnen
Privates Surfen verwenden
Kopieren Sie den bereitgestellten Nutzernamen und das Passwort für das Lab
Klicken Sie im privaten Modus auf Konsole öffnen
In der Konsole anmelden
Melden Sie sich mit Ihren Lab-Anmeldedaten an. Wenn Sie andere Anmeldedaten verwenden, kann dies zu Fehlern führen oder es fallen Kosten an.
Akzeptieren Sie die Nutzungsbedingungen und überspringen Sie die Seite zur Wiederherstellung der Ressourcen
Klicken Sie erst auf Lab beenden, wenn Sie das Lab abgeschlossen haben oder es neu starten möchten. Andernfalls werden Ihre bisherige Arbeit und das Projekt gelöscht.
Diese Inhalte sind derzeit nicht verfügbar
Bei Verfügbarkeit des Labs benachrichtigen wir Sie per E-Mail
Sehr gut!
Bei Verfügbarkeit kontaktieren wir Sie per E-Mail
Es ist immer nur ein Lab möglich
Bestätigen Sie, dass Sie alle vorhandenen Labs beenden und dieses Lab starten möchten
Privates Surfen für das Lab verwenden
Am besten führen Sie dieses Lab in einem Inkognito- oder privaten Browserfenster aus. So vermeiden Sie Konflikte zwischen Ihrem privaten Konto und dem Teilnehmerkonto, die zusätzliche Kosten für Ihr privates Konto verursachen könnten.
In this hands-on lab, you'll learn how setup both network load balancers and HTTP load balancers for your application running in Google Compute Engine virtual machines. Watch the short preview Set Up Network & HTTP Load Balancers, GCP Essentials.