0
0
GCPcloud~30 mins

TCP/UDP Load Balancer (Layer 4) in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
TCP/UDP Load Balancer (Layer 4) on Google Cloud Platform
📖 Scenario: You are setting up a simple network service on Google Cloud Platform (GCP) that needs to distribute incoming TCP or UDP traffic evenly across multiple backend virtual machines. This helps your service handle more users and stay available even if one machine fails.
🎯 Goal: Create a TCP/UDP Load Balancer on GCP that forwards traffic on port 8080 to two backend VM instances. You will define the backend instances, create a health check, configure the load balancer forwarding rule, and set up the target pool.
📋 What You'll Learn
Create two VM instances named vm-instance-1 and vm-instance-2 in the us-central1-a zone.
Create a TCP health check named tcp-health-check on port 8080.
Create a target pool named tcp-udp-target-pool that includes both VM instances and uses the health check.
Create a forwarding rule named tcp-udp-forwarding-rule that listens on port 8080 and forwards traffic to the target pool.
Use the gcloud command-line tool syntax for all configurations.
💡 Why This Matters
🌍 Real World
Layer 4 load balancers are used to distribute network traffic efficiently to backend servers, improving availability and scalability of applications.
💼 Career
Understanding how to configure TCP/UDP load balancers on cloud platforms like GCP is essential for cloud engineers and network administrators to build reliable and scalable services.
Progress0 / 4 steps
1
Create two VM instances
Use the gcloud compute instances create command to create two VM instances named vm-instance-1 and vm-instance-2 in the us-central1-a zone. Both should use the e2-micro machine type and the debian-11 image family.
GCP
Need a hint?

Use the gcloud compute instances create command twice, once for each VM instance, specifying the zone, machine type, and image family.

2
Create a TCP health check
Create a TCP health check named tcp-health-check that checks port 8080 to monitor the health of backend instances.
GCP
Need a hint?

Use gcloud compute health-checks create tcp with the name tcp-health-check and specify port 8080.

3
Create a target pool with backend instances and health check
Create a target pool named tcp-udp-target-pool in the us-central1-a zone. Add the two VM instances vm-instance-1 and vm-instance-2 as backends, and associate the tcp-health-check with this target pool.
GCP
Need a hint?

Create the target pool with the health check, then add both VM instances specifying their zone.

4
Create a forwarding rule for the load balancer
Create a forwarding rule named tcp-udp-forwarding-rule in the us-central1 region. It should listen on port 8080 for TCP traffic and forward it to the target pool tcp-udp-target-pool.
GCP
Need a hint?

Use gcloud compute forwarding-rules create with the correct name, region, port, target pool, and protocol.