Cloud Load Balancing, Cloud CDN and Cloud DNS: Choosing the Right Load Balancer for Every Workload
Why Google's Load Balancing Is Special
- The global external Application Load Balancer uses a single anycast IP address worldwide
- Users connect to the nearest Google edge, then traffic rides Google's backbone to the closest healthy backend
- It is a managed, software-defined service, so no pre-warming and it scales with traffic
The Types
| Load balancer | Layer | Scope | Use |
|---|---|---|---|
| Global external Application LB | 7 (HTTP/S) | Global | Public websites and APIs worldwide, CDN, Cloud Armor |
| Regional external Application LB | 7 | Regional | Public apps limited to one region (data residency) |
| Internal Application LB | 7 | Regional (or cross-region) | Private microservices inside a VPC |
| External proxy Network LB | 4 (TCP/SSL proxy) | Global or regional | Non-HTTP TCP with SSL offload |
| External passthrough Network LB | 4 | Regional | TCP/UDP, preserve client IP, very high performance |
| Internal passthrough Network LB | 4 | Regional | Private TCP/UDP services, databases, appliances |
Decision Tree
text
Is the traffic HTTP or HTTPS?
├─ Yes ─ External users? ─ Yes ─ Global needed? ─ Yes → Global external Application LB
│ └ No → Regional external Application LB
│ └ No (internal) → Internal Application LB
└─ No (TCP/UDP) ─ External? ─ Yes ─ Need client IP preserved? ─ Yes → External passthrough Network LB
└ No → External proxy Network LB
└ No → Internal passthrough Network LB
Parts of an Application Load Balancer
| Part | Meaning |
|---|---|
| Forwarding rule | The IP address and port that receives traffic |
| Target proxy | Terminates HTTP(S) and holds SSL certificates |
| URL map | Routes by host and path, for example /api/* to one backend |
| Backend service | A set of backends plus health check, balancing mode, timeout, CDN and security policy |
| Backends | Instance groups, network endpoint groups (Cloud Run, GKE pods, serverless), Cloud Storage buckets |
| Health check | Decides which backends receive traffic |
Build a Global HTTP Load Balancer
bash
gcloud compute addresses create web-ip --global
gcloud compute health-checks create http web-hc --port=80 --request-path=/health
gcloud compute backend-services create web-backend --global --protocol=HTTP --health-checks=web-hc --enable-cdn
gcloud compute backend-services add-backend web-backend --global --instance-group=web-mig --instance-group-region=asia-south1
gcloud compute url-maps create web-map --default-service=web-backend
gcloud compute ssl-certificates create web-cert --domains=www.example.com --global
gcloud compute target-https-proxies create web-proxy --url-map=web-map --ssl-certificates=web-cert
gcloud compute forwarding-rules create web-fr --global --address=web-ip --target-https-proxy=web-proxy --ports=443
- Google-managed certificates renew automatically once DNS points to the load balancer IP
- Add an HTTP to HTTPS redirect with a second URL map
- Use serverless NEGs to put Cloud Run behind the same load balancer for custom domains and Cloud Armor
Cloud CDN
- Caches content at Google's edge so repeat requests are fast and cheaper
- Enabled per backend service or backend bucket on the global external Application LB
- Control with cache modes (cache static content, use headers, force cache), TTLs, cache invalidation and signed URLs for private content
Cloud DNS
- Managed, global authoritative DNS with 100 percent availability SLA
- Public zones (internet) and private zones (only inside chosen VPCs)
- Routing policies: weighted, geolocation, failover
- DNSSEC support
- Forwarding zones and inbound policies for hybrid name resolution with on-premises
bash
gcloud dns managed-zones create example-zone --dns-name="example.com." --description="public zone"
gcloud dns record-sets create www.example.com. --zone=example-zone --type=A --ttl=300 --rrdatas=34.120.1.2
gcloud dns managed-zones create corp-private --dns-name="corp.internal." --visibility=private --networks=prod-vpc --description="private"
Security With Load Balancers
- Attach Cloud Armor for WAF and DDoS
- Use IAP for user login in front of internal tools
- Use modern SSL policies (minimum TLS 1.2)
- Keep backends private and allow only Google health check and proxy ranges
Practice
- Build the global load balancer in front of the MIG from the earlier lesson
- Add a
/images/*path backed by a Cloud Storage bucket with CDN - Create a private DNS zone and resolve a name from a VM
- Choose the right load balancer for: public API worldwide, private database proxy, game UDP server
Conclusion
Pick the load balancer by protocol, audience and scope. The global external Application LB gives one anycast IP, CDN and Cloud Armor. Use passthrough network LBs for TCP/UDP and internal LBs for private services, and use Cloud DNS for public and private names.
Quick Summary: special; types; decision tree; parts; build; CDN; DNS; security.

