DevOps Peach

GCP Basics · Load Balancing & Hybrid – Cloud Load Balancing, Cloud Armor, CDN, VPN and IAP · Lesson 2 of 5

External Application Load Balancer and Cloud Armor

Terminate TLS with managed certificates on a global external Application Load Balancer, and attach Cloud Armor security policies for WAF rules, IP and geo filtering and rate limiting.

Practice interactively →

The global external Application Load Balancer is the front door for most public web apps on Google Cloud. Cloud Armor plugs into it at Google’s edge to filter attacks before they reach your backends.

flowchart LR
  A["Attacker and users"] --> GFE["Google Front End<br/>anycast IP, TLS"]
  GFE --> CA["Cloud Armor policy shop-policy<br/>WAF, geo, rate limit"]
  CA -- "allowed" --> BS["Backend service web-backend"]
  CA -- "denied" --> D["HTTP 403 / 429"]
  BS --> APP["Regional MIG / Cloud Run"]
  %% step A: Requests from users and attackers arrive at the nearest Google Front End.
  %% step GFE: The load balancer terminates TLS with a Google-managed certificate; volumetric L3/L4 DDoS is absorbed here by default.
  %% step CA: The Cloud Armor policy on the backend service evaluates its rules from the lowest priority number.
  %% step D: Blocked requests get 403 or 429 at the edge and never reach your VMs.
  %% step BS: Allowed requests go to the backend service and on to healthy backends.

TLS certificates

Cloud Armor security policies

A policy has ordered rules (priority 0 = first) plus a default rule at priority 2147483647 that allows or denies everything else.

Rule type Example
IP allow/deny --src-ip-ranges=203.0.113.0/24 --action=deny-403
Geo --expression="origin.region_code == 'VN'"
Preconfigured WAF (OWASP CRS) evaluatePreconfiguredWaf('sqli-v33-stable'), 'xss-v33-stable'
Rate limiting --action=throttle or rate-based-ban per client IP
Bot management reCAPTCHA Enterprise integration

Other features:

gcloud compute security-policies create shop-policy --description="Shop WAF"
gcloud compute security-policies rules create 1000 --security-policy=shop-policy   --expression="evaluatePreconfiguredWaf('sqli-v33-stable')" --action=deny-403
gcloud compute backend-services update web-backend --global --security-policy=shop-policy

End-to-end design

DNS shop.example.com → static global IP → HTTPS proxy (managed cert, TLS 1.2+)
  → URL map → backend service (Cloud Armor, CDN) → regional MIG in 3 zones

Reserve the IP first (gcloud compute addresses create shop-ip --global) so it never changes when you rebuild the LB.

Command Meaning
gcloud compute security-policies list Policies
gcloud compute security-policies rules update 1000 --security-policy=shop-policy --preview Put a rule in preview
gcloud compute ssl-certificates create shop-cert --domains=shop.example.com --global Managed certificate

Traps: a managed certificate stays PROVISIONING until DNS points to the LB; Cloud Armor attaches to backend services, not to VMs; deny rules with too broad expressions can block health checks or your own monitoring.

Practice interactively →