Create a Load Balancer
A Load Balancer spreads incoming traffic across several servers so no one server carries everything and the loss of one
does not take you down. You build it in layers: the load balancer itself, a listener, a pool of servers, and a health
check.
Step 1 — Create the load balancer
1. Open Networking, then Load Balancers, and click Create Load Balancer.
2. Set:
- Name: for example web-lb.
- Subnet: the subnet your backend servers are on.
- Availability Zone: match your servers' region.
Step 2 — Add a listener
The listener is what the load balancer listens for.
- Protocol and Port: for a website, HTTP on 80, or HTTPS on 443. For HTTPS, attach a certificate (see TLS
Certificates).
Step 3 — Create a pool
The pool is the group of backend servers and how traffic is shared.
- Algorithm: Round Robin sends requests to each server in turn and suits most cases.
Step 4 — Add members
The members are the actual servers.
- Add each backend server and the port its application listens on (for example 80).
Step 5 — Add a health monitor
The health check quietly removes an unhealthy server from rotation until it recovers.
- Choose a type (an HTTP check on a health URL, or a simple TCP check) and the interval.
Finish
Give the load balancer a public IP and open the listener's port in your security rules. For real redundancy, put the
backend servers in an anti-affinity Placement Group so they never share a host.