Cloud Armor in Google Cloud

Cloud Armor in Google Cloud

A complete, friendly guide to Google Cloud's web application firewall and DDoS defense service: how it inspects traffic at the edge, how to write rules that block attackers without blocking customers, and how to roll it out safely, watch it, and pay for it wisely.

Picture a popular shop on a busy street. Most people who walk in are customers. But a few are troublemakers: someone trying to jam the doors by sending in a thousand friends at once, someone sneaking in with a crowbar to open the cash register, and someone who pretends to be a customer a hundred times a minute to copy the whole price list. A good shop does not simply hope for the best. It has a security guard at the entrance who knows what trouble looks like and stops it before it reaches the shelves.

Every website and app on the internet is that shop. Within minutes of going live, a new site starts receiving strange visitors: automated scanners that probe for weak spots, bots that try thousands of stolen passwords, and sometimes huge floods of fake traffic meant to knock the site offline. Writing perfect code is not enough on its own, because even a small, unnoticed mistake can become an open door.

Cloud Armor is Google Cloud’s security guard for the front door of your applications. It sits at the edge of Google’s network, looks at each request before it reaches your servers, and decides whether to let it in, block it, slow it down, or challenge it. In this guide you will start with the basics of web attacks, and then build up to rules, policies, bot defense, DDoS protection, monitoring, and cost. Every new term is explained the first time it appears, with an everyday comparison.

1What Is Cloud Armor?

Before any rules or diagrams, let us get one clear picture of what this product is and what it is for.

Cloud Armor is a network security service on Google Cloud. It combines two protections in one product. The first is a web application firewall, usually shortened to WAF. A WAF reads web requests and blocks the ones that look like attacks, such as attempts to trick your database or to inject harmful scripts into your pages. The second is DDoS protection. DDoS stands for distributed denial of service, which means a flood of traffic from many machines at once, sent to overwhelm a site so real users cannot get in.

You control Cloud Armor through security policies. A policy is a list of rules, and each rule says “if a request looks like this, then do that”. You attach a policy to a service that sits behind a Google Cloud load balancer, and from that moment every request is checked against your rules before it is passed along.

Everyday analogy

Think of the entrance to a large concert hall. A security team stands at the gate with a clipboard of instructions: let in ticket holders, turn away people on a banned list, send anyone who looks suspicious to a second check, and limit how many people can squeeze through per minute. The team works at the gate, far from the stage, so troublemakers never reach the performers. Cloud Armor is that gate team, and the security policy is the clipboard.

Layer 7
Inspects web requests, not just network packets
Edge
Rules run at Google’s network edge, close to the attacker
0
Security appliances you need to buy or run

What Cloud Armor can do

Allow and block

IP and geography rules

Block known bad addresses, allow only trusted ranges, or restrict access by country or region.

Firewall

Preconfigured WAF rules

Ready-made protection against common attacks such as SQL injection and cross-site scripting.

Custom

Your own rules

Write conditions that match headers, paths, methods, and more, to protect the exact quirks of your app.

Slow down

Rate limiting

Cap how many requests a single client can send, and ban those that keep exceeding the limit.

Bots

Bot management

Challenge suspicious visitors and use scoring to tell humans from scripts.

Flood defense

DDoS and Adaptive Protection

Absorb huge floods, and use machine learning to spot and suggest rules against new application-layer attacks.

i
Tip

Cloud Armor does not replace secure coding. It is a safety net, not a substitute for fixing bugs. Think of it as a seat belt: you still drive carefully, but when something goes wrong, it reduces the damage.

2The Threat Landscape: What Are We Defending Against?

You cannot choose good defenses without knowing the attacks. This chapter explains the main ones in simple words.

Attack family 1: floods (DDoS)

A denial of service attack tries to make a service unusable by overloading it. When the traffic comes from thousands of hijacked computers at once, it is called a distributed denial of service. The hijacked machines form a botnet, a network of infected devices controlled remotely by an attacker, often without their owners knowing. DDoS attacks come in three main styles.

Layers 3 and 4

Volumetric floods

Enormous amounts of raw network traffic meant to fill the pipes leading to a site. Like thousands of trucks blocking a road so no car can pass.

Layer 4

Protocol attacks

Abuse of how network connections are set up, such as starting millions of connections and never finishing them, until the server runs out of room for real ones.

Layer 7

Application-layer attacks

Floods of requests that look like real web visits but ask for expensive pages again and again. Harder to spot because each request looks normal alone.

Attack family 2: exploits against your application

These attacks do not need huge numbers. They need only one weak spot.

  • SQL injection: The attacker types database commands into a form field or web address. If your app is careless, the database obeys them and may reveal or delete data.
  • Cross-site scripting (XSS): The attacker smuggles a harmful script into a page so that it runs in other visitors’ browsers and steals their sessions.
  • Local and remote file inclusion: The attacker tricks the app into reading a file it should not, or loading code from the attacker’s site.
  • Remote code execution: The attacker gets the server to run commands of their choosing. This is among the most dangerous outcomes.
  • Scanners and probes: Automated tools that try thousands of common weak addresses and known flaws, looking for any unpatched system.

Attack family 3: abuse by bots

  • Credential stuffing: Bots try lists of stolen usernames and passwords from other breaches on your login page.
  • Scraping: Bots copy all your prices, articles, or listings, often to resell or undercut you.
  • Inventory hoarding: Bots add scarce items to carts or buy them instantly, shutting out real customers.
  • Fake account creation: Bots sign up in bulk to abuse free trials or spread spam.
Everyday analogy

Back at the shop: a DDoS attack is a mob blocking the doors. An exploit is a burglar with a crowbar who knows which windows have weak latches. A bot is a person who walks in a hundred times an hour pretending to be a different customer each time. Each needs a different kind of guard: crowd control, lock inspection, and identity checks.

The OWASP Top 10

OWASP, the Open Worldwide Application Security Project, is a respected nonprofit community that publishes a famous list of the most common serious web application risks, known as the OWASP Top 10. It includes problems such as injection, broken access control, and security misconfiguration. Many WAF products, Cloud Armor included, base part of their protection on a set of rules maintained by this community. A WAF can block many attempts to use these weaknesses, but it cannot fix flaws such as a login system that forgets to check permissions. Those must be fixed in the code.

!
Common myth

“We have a WAF, so our app is secure.” A WAF reduces risk by blocking known patterns, but attackers keep inventing new ones, and some flaws look completely normal in a request. Treat the WAF as one layer in a set of layers, never as the only one.

3A Short History and Where Cloud Armor Fits

Understanding the story explains why Cloud Armor lives where it does, at the edge of Google’s network.

01

The early firewall era

The first firewalls watched network traffic by address and port number, like a guard who checks only which street a visitor came from. They could not read the contents of a web request.

02

Web attacks rise

As more business moved onto websites, attackers targeted the apps themselves with injection and scripting tricks that looked like ordinary web traffic, slipping past address-based firewalls.

03

The WAF is born

Web application firewalls appeared to read and understand web requests, blocking those that matched known attack patterns. The community-maintained rule collections used by many of them became a shared standard.

04

Internet-scale floods

Botnets made DDoS attacks bigger every year. Defending against them needed enormous capacity, far beyond what a single company could buy for its own data center.

05

Google brings its own defenses to customers

Google had long protected its own services, such as Search and YouTube, using a global front end network. Cloud Armor, introduced in the second half of the 2010s, let Google Cloud customers use that same protective layer for their own applications.

06

Later years: smarter and broader

Google added preconfigured WAF rules, rate limiting, bot defense with reCAPTCHA Enterprise, machine-learning-based Adaptive Protection, threat intelligence lists, and support for more kinds of load balancers and endpoints.

Why the edge matters

Google runs a huge global network with many points of presence close to users all over the world. Traffic to a Google Cloud global load balancer enters this network at the point nearest the sender, and Cloud Armor rules are applied right there. Bad requests are dropped at the edge, thousands of kilometers from your servers, so they never consume your bandwidth, your CPU, or your money. Google has publicly reported that this approach has absorbed record-setting attacks, including a flood of tens of millions of requests per second reported in 2022, without the protected customer going offline.

Everyday analogy

Imagine stopping a flood by building barriers upstream in the mountains instead of piling sandbags around your house. The water is dealt with where it is thin and far away, long before it can reach and drown your home. Edge protection works the same way.

Defense in depth

Security experts use the phrase defense in depth, meaning several independent layers of protection so that a failure in one does not cause a total breach. A castle has a moat, a wall, a gate, and guards inside. For a cloud application, the layers include secure code, patched software, careful access permissions, network firewalls, encryption, monitoring, and an edge WAF such as Cloud Armor. Cloud Armor is the first layer an attacker meets, and it is built to thin out most of the dangerous traffic before it reaches the others.

!
Good to know

Features, supported load balancers, limits, and prices change over time. Treat this guide as a map of the ideas, and check Google Cloud’s official documentation for the current exact details before you finalize a design.

4Core Concepts: Policies, Rules, Priorities, and Actions

A handful of simple ideas explain almost everything in Cloud Armor.

Container

Security policy

A named list of rules. You attach a policy to one or more backend services, and it then protects them. One policy can guard many services.

Instruction

Rule

One line in the policy: a condition to match, an action to take, and a priority number.

Order

Priority

A number that sets the order of checking. Lower numbers are checked first. The first rule that matches decides the result.

Condition

Match expression

The test a rule applies. It can be as simple as a list of IP ranges or as rich as a combined statement about headers, paths, and request details.

Result

Action

What to do when a rule matches: allow, deny, throttle, ban, or redirect for a challenge.

Fallback

Default rule

The last rule, with the lowest priority, which handles anything no other rule matched. It always exists and is usually set to allow.

The actions in detail

ActionWhat it doesTypical use
AllowLets the request through to the backendTrusted partner addresses, or exceptions that must always pass
DenyBlocks the request and returns an error code to the sender, such as 403, 404, or 502Known bad addresses, blocked countries, attack patterns
ThrottleLets requests through up to a rate limit and rejects the excessProtecting expensive endpoints from overuse
Rate-based banAfter a client exceeds a rate, blocks all its requests for a set timeStopping repeated abusers and password guessers
RedirectSends the client to a challenge, such as a reCAPTCHA checkSeparating humans from bots when unsure

How priority works

The number is easy to mix up, so say it slowly: the smaller the number, the earlier the rule is checked. Rule 100 is looked at before rule 200. As soon as one rule matches, Cloud Armor applies its action and stops looking at the rest. So specific exceptions should have smaller numbers than broad blocks. A common pattern is to put “always allow my office” first, then “block bad addresses”, then “apply WAF rules”, then “rate limits”, and leave the default rule last.

Everyday analogy

Think of a doorman reading from a numbered card. Rule 1: “If it is the owner, let them in.” Rule 2: “If the person is on the banned list, turn them away.” Rule 3: “If they carry a bag, check the bag.” The doorman stops at the first rule that applies. If the owner’s name were rule 50 instead of rule 1, a banned list might shut out the owner first.

Preview mode

Any rule can be set to preview. In preview mode the rule still checks every request and writes what it would have done into the logs, but it does not actually block anything. This is a priceless safety feature: you can test a new rule against real traffic and see which real customers it would have hurt before it ever touches them.

i
Tip

Space your priorities out, for example 1000, 2000, 3000, instead of 1, 2, 3. Later, when you need to slip a new rule in between two existing ones, there is room, and you will not have to renumber everything.

5Architecture and Components

Now let us zoom out and see where Cloud Armor sits among the other parts of a Google Cloud application.

Cloud Armor is not a box you place in your network. It is a feature that is applied by Google’s load balancing infrastructure. Requests from users reach Google’s edge, go through the load balancer’s front end, are checked by the attached security policy, and only then travel on to your backends. The backends can be virtual machines, containers on Google Kubernetes Engine, serverless services such as Cloud Run, storage buckets, or even servers outside Google Cloud.

flowchart LR
    U["Users, Bots and Attackers"] --> EDGE["Google Edge Network"]
    EDGE --> LB["Global External Load Balancer"]
    LB --> CA["Cloud Armor Security Policy"]
    CA -->|"Allowed"| BS["Backend Service"]
    CA -->|"Denied"| BLK["Blocked at the Edge"]
    BS --> VM["VM Instance Groups"]
    BS --> GKE["GKE Containers"]
    BS --> RUN["Cloud Run Services"]
    CA --> LOG["Cloud Logging and Monitoring"]
    CA --> TI["Threat Intelligence and Adaptive Protection"]
    
Figure 1: Cloud Armor evaluates traffic as part of the load balancer at the edge, before requests reach your backends.

The components, one at a time

Entry

Google edge network

Points of presence all around the world where user traffic first enters Google’s network, close to where the user is.

Traffic cop

Load balancer

Receives requests and spreads them across backends. Cloud Armor attaches to its backend services.

Guard

Security policy

Your rules, evaluated for every request that arrives at the protected backend service.

Destination

Backend service

The group of servers or functions that actually handles the traffic. The policy is attached to this object.

Record

Logging and monitoring

Every decision can be logged, and counters feed dashboards and alerts.

Brain

Adaptive Protection and threat intelligence

Machine learning to spot odd traffic patterns, and curated lists of known malicious sources, available in the enterprise tier.

What Cloud Armor protects

Over time Cloud Armor has been extended beyond the classic web setup. Depending on the type of policy, it can protect traffic arriving at external application load balancers, which handle web traffic, at external proxy network load balancers, and at passthrough network load balancers and virtual machines that have public addresses. The next chapters explain the different policy types and which ones fit which situation.

Everyday analogy

An airport has a security checkpoint between the public hall and the gates. Every traveler passes through it, whichever airline or gate they are heading for. The load balancer is the hall with several gates. Cloud Armor is the security checkpoint built into the building, not a separate checkpoint each airline must build at its own gate.

!
Watch out

Cloud Armor only protects traffic that goes through the load balancer it is attached to. If your backend servers can also be reached directly by their own public addresses, attackers can simply walk around the guard. Locking down the backends is covered later and is one of the most important steps of all.

6Internal Working: What Happens to a Single Request

Let us follow one web request from a visitor’s browser all the way to your server, and see where each decision is made.

sequenceDiagram
    participant C as Client
    participant E as Google Edge
    participant A as Cloud Armor Policy
    participant L as Load Balancer
    participant B as Your Backend
    C->>E: Opens secure connection
    E->>A: Request details for evaluation
    A->>A: Check rules in priority order
    alt Request is allowed
        A-->>L: Allow
        L->>B: Forward request
        B-->>C: Response
    else Request is denied
        A-->>C: Error response such as 403
    end
    A->>A: Write decision to logs
    
Figure 2: A request is evaluated at the edge. Allowed requests move on to the backend, and denied requests never reach it.

The journey, step by step

1

The visitor connects

The browser opens a secure connection to your site’s public address. Because that address belongs to a Google global load balancer, the connection ends at the nearest Google edge location.

2

Network-level defenses run first

Google’s infrastructure already filters many attacks aimed at the network and transport layers, such as floods and malformed connection attempts, before your rules are involved.

3

The request is read

The edge reads the web request: the source address, the path, the method, the headers, and, within limits, the beginning of the body.

4

Rules are checked in order

Cloud Armor goes through your rules from the smallest priority number upward. The first rule whose condition matches decides what happens.

5

The action is applied

Allow means the load balancer picks a backend and forwards the request. Deny means the client gets an error response immediately. Throttle, ban, and redirect behave as described earlier.

6

The decision is recorded

A log entry notes which policy and rule matched and what happened, along with any preview rules that would have matched.

What Cloud Armor can see in a request

  • Source address: where the request appears to come from, and the approximate country it maps to.
  • Method and path: for example, a POST to the login address.
  • Query string: the part of the web address after the question mark.
  • Headers: labelled extra details, such as the browser name, language, and cookies.
  • Body: Cloud Armor can look at only an initial part of the request body, a few kilobytes in documented limits. Check the current limit, because an attacker may try to hide a harmful payload beyond the part that is inspected.

Encrypted traffic

Most web traffic today is encrypted. Because the secure connection ends at Google’s load balancer, which holds your certificate, the load balancer can read the request in plain form for evaluation. That is why Cloud Armor works with encrypted web traffic without extra effort, and why it must be tied to the load balancer, not to the backend machines.

Everyday analogy

It is like a mailroom at the front of a company building. All letters arrive at the mailroom, where staff open each one, check it against a list of warnings, and only deliver the safe ones to the floors above. If letters were delivered straight to each desk, nobody could check them in one place.

i
Tip

Remember that the first matching rule wins and the rest are ignored. When a request is blocked and you cannot see why, look for an earlier rule with a smaller number that caught it, not at the rule you expected.

7Policy Types: Matching the Policy to What You Protect

Cloud Armor offers more than one kind of policy. Choosing the right kind depends on what sits behind the guard.

Not all traffic enters Google Cloud the same way, so Cloud Armor provides several policy types. Names and capabilities evolve, so verify the current list in the documentation, but the main ideas are stable.

Policy typeAttached toWhat it is for
Backend security policyBackend services behind external application load balancersThe main policy type. Full WAF rules, rate limiting, bot defense, and custom rules for web applications
Edge security policyBackend services and backend buckets that use Cloud CDNEarly filtering of requests before the content cache is consulted, for example blocking by country or address ahead of the cache
Network edge security policyPassthrough load balancers, protocol forwarding, and virtual machines with public addressesProtection for non-web traffic, with advanced network DDoS defense and address-based rules
Regional security policyBackend services behind regional load balancersRules that apply to a single region, for workloads that must stay within one location

A closer look

Most common

Backend policy

If you run a website or an API behind a Google Cloud external application load balancer, this is the policy you will use nearly every day.

Before the cache

Edge policy

Useful when you serve a lot of cached content. Blocking a bad source before the cache check keeps it from even learning what is cached.

Not just web

Network edge policy

For game servers, mail servers, and other services that speak something other than normal web traffic and sit behind a network load balancer or on a public address.

flowchart TD
    START["What are you protecting?"] --> Q1{"Web traffic through an application load balancer?"}
    Q1 -->|"Yes"| Q2{"Heavy use of Cloud CDN caching?"}
    Q2 -->|"Yes"| BOTH["Use backend policy plus edge policy"]
    Q2 -->|"No"| BACK["Use a backend security policy"]
    Q1 -->|"No"| Q3{"Network load balancer or VM with a public address?"}
    Q3 -->|"Yes"| NET["Use a network edge security policy"]
    Q3 -->|"No"| CHK["Check the current documentation for supported targets"]
    
Figure 3: A simple decision path for choosing a policy type.

Sharing one policy across services

A single policy can be attached to many backend services. This is wonderful for consistency: your company can create a baseline policy with its standard protections and attach it to every service, instead of rebuilding the same rules many times. If a service needs extra rules, give it its own policy, built on the baseline plus its specialties.

i
Tip

Start with one baseline policy that every internet-facing service uses, and review it regularly. Add separate, stricter policies only for services that really need them, such as login or payment systems.

8Address, Region, and Threat-Intelligence Rules

The simplest and most dependable rules look only at where a request comes from.

IP address rules

Every device on the internet has an IP address, a number that identifies where it is. A CIDR range is a compact way of writing a whole block of addresses at once. Cloud Armor rules can match a single address or a block, and then allow or deny it.

  • Allow lists: permit only trusted ranges, such as your office or a partner, to reach an admin page. Everything else is denied.
  • Deny lists: block addresses that have attacked you before.
  • Combined with other tests: for example, only allow the office range to reach paths that begin with the admin section.

Geographic rules

Cloud Armor can guess the country or region of a request using a database that maps addresses to places, and use a standard two-letter region code in rules. This lets you block countries you never serve, or reserve a service for a single country because of law or licensing.

!
Watch out

Location from an IP address is a good estimate, not a certainty. Travelers, mobile networks, and VPN or proxy services can make a person appear to be elsewhere, and attackers can easily use addresses in an allowed country. Use geography as a coarse filter, never as your only protection.

Named IP lists and threat intelligence

Maintaining huge lists of dangerous addresses by hand is impractical. The enterprise tier of Cloud Armor provides threat intelligence, which means curated, regularly updated groups of addresses that Google tracks. Typical groups include exit points of anonymizing networks, known malicious sources, and ranges used by search engine crawlers or public cloud providers. You simply reference the group name in a rule, and Google keeps the contents fresh.

  • Block anonymizing exit points from a sensitive login page.
  • Block ranges known as sources of malicious traffic.
  • Allow well-known search engine crawlers so your site stays visible in search while you block scrapers.
  • Treat traffic from public cloud ranges with extra suspicion on pages meant only for humans.

The client address behind other proxies

Cloud Armor must identify the real client. If your traffic first passes through another service before reaching Google, such as a third-party content network, the address Google sees is that service’s, not the visitor’s. In such cases you configure Cloud Armor to read the visitor’s address from a specific request header that the first service fills in. Without this, every visitor appears to come from the same address, and an address-based block or a rate limit would hit everybody at once.

Everyday analogy

It is like a receptionist who is told “block anyone from the building across the street” but whose visitors all arrive in the same taxi. Unless she looks at the passenger and not at the taxi’s number plate, she will turn away or admit everyone as a group.

i
Tip

Keep address lists short and meaningful. Giant hand-built block lists go stale quickly, because attackers change addresses constantly, and old entries can end up blocking innocent users who later received those addresses.

9Preconfigured WAF Rules: Ready-Made Protection

Writing rules to catch every attack pattern yourself would take a team of experts years. Cloud Armor gives you a head start.

Cloud Armor includes preconfigured WAF rules. These are bundles of detection patterns, called signatures, built from versions of the OWASP ModSecurity Core Rule Set, a widely respected collection of attack-detection rules maintained by security experts. Instead of writing signatures yourself, you switch on a bundle by name and Cloud Armor applies it to your traffic.

The main bundles

Protection groupWhat it looks for
SQL injectionDatabase commands hidden in form fields, paths, and parameters
Cross-site scriptingScript fragments planted in requests to run in other users’ browsers
Local file inclusionTricks that make the app read files it should not, such as system files
Remote file inclusionTricks that make the app load code from an outside address
Remote code executionAttempts to run commands on the server
Method enforcementUse of unusual or unwanted web methods
Scanner detectionThe fingerprints of well-known automated vulnerability scanners
Protocol attacksMalformed or suspicious requests that abuse web protocol rules
Session fixationAttempts to force a user into a known login session
Language and framework groupsAttacks aimed at particular technologies, such as PHP, Java, and Node.js
Known vulnerabilitiesPatterns for specific widely exploited, publicly listed flaws

Sensitivity levels

Each bundle can be applied at a chosen sensitivity level, from low to high. A lower level uses only the most reliable signatures, which rarely block normal visitors by mistake. A higher level adds more signatures that catch more subtle attacks, but also raise the chance of blocking legitimate traffic. This chance is called a false positive: a normal request wrongly treated as an attack.

Lower sensitivity

  • Fewer false positives
  • Safe for most public websites to start with
  • Blocks the obvious and well-known attacks
  • Misses some cleverly disguised attempts

Higher sensitivity

  • Catches more subtle attack variants
  • Better for high-value targets such as payments
  • More false positives, especially with rich text forms and code snippets
  • Needs careful testing and tuning

False positives and how to tame them

Imagine a forum where people discuss programming. A user posts a message containing a database command as an example. A WAF may reasonably think it is an attack. The fix is not to switch the WAF off. It is to tune it, and Cloud Armor gives you several ways.

  • Start in preview mode. See what would be blocked using real traffic before enforcing anything.
  • Opt out of individual signatures. If one specific signature keeps blocking a legitimate action, disable that signature alone, not the whole bundle.
  • Exclude specific request fields. Tell the WAF to ignore a particular parameter, header, or cookie when checking, for example a field that contains rich text.
  • Apply different levels to different paths. Use a strict level on the login and payment paths, and a gentler one on the rest of the site.
  • Add narrow exceptions. Create an allow rule with a smaller priority number for a trusted address or very specific safe request.
Everyday analogy

A metal detector at an airport set to the highest sensitivity beeps for belt buckles and coins, and the queue grows. Set too low, it misses small weapons. Security staff tune it by testing, by checking what sets it off, and by adding a second check only where the risk is greatest.

!
Watch out

Never turn on a bundle at high sensitivity directly in enforcement mode on a busy production site. Always preview first, look at the logs for a few days covering a full business cycle, tune, and only then enforce.

10Custom Rules and Rate Limiting

Your application is unique. Custom rules let you describe its special risks, and rate limiting keeps any single visitor from taking more than a fair share.

Custom rules with expressions

Besides simple address lists, Cloud Armor lets you write rule conditions as expressions, using a compact condition language called the Common Expression Language. An expression is a statement that is true or false for each request, and you can combine statements with “and”, “or”, and “not”. Without writing out code here, here is the kind of thing you can say in words:

  • If the path begins with the admin section and the source is outside the office range, deny.
  • If the method is one that your site never uses, deny.
  • If a particular header is missing that every real client of your mobile app always sends, deny or challenge.
  • If the browser identification text matches a known bad scraper, deny.
  • If the request comes from a certain region and targets the checkout, send to a challenge.
  • If the request carries a known-bad cookie value from an old attack, deny.
i
Tip

Attackers can fake headers such as the browser name easily. Use header-based rules to catch lazy attackers and reduce noise, but do not depend on them to stop skilled ones.

Rate limiting

Rate limiting restricts how often a client can do something. It is the right tool for problems that have nothing wrong with any single request, such as a bot hammering a login page. Cloud Armor offers two actions for this.

Gentle

Throttle

Set a maximum number of requests per time window per client. Requests inside the limit pass, and the excess is rejected. Clients that slow down are served again at once.

Firm

Rate-based ban

If a client goes over a higher limit, block it completely for a set duration, such as ten minutes. Good against persistent abusers and password guessers.

Who counts as “one client”?

A rate limit needs a way to decide which requests belong together. Cloud Armor lets you choose the key: the source address, the address from a forwarded header, the country, a particular header or cookie value, or other keys. Choosing carefully matters.

  • By address: simple, but many people behind a company or school network share one address, and one noisy user could limit everybody.
  • By a user or session identifier: more precise for logged-in areas, but attackers can rotate identifiers.
  • By all clients together: a global ceiling protecting a fragile backend, at the cost of treating everyone alike.

Where limits help most

  • Login and password reset pages, against guessing and stuffing.
  • Search and report endpoints that are expensive to run.
  • Sign-up and contact forms, against spam.
  • Public APIs, to keep fair use among customers.
Everyday analogy

A water tap with a flow restrictor lets a normal user fill a glass without problems but stops one person from emptying the whole tank in a minute. A ban is like shutting off the tap for a while for anyone who keeps trying to force it open.

!
Watch out

Set limits above what a real user can do, not just what the average user does. A power user who clicks quickly, or a mobile app that fires several requests at once at startup, should not be treated as an attacker. Preview the rule first and look at the busiest legitimate clients before choosing the number.

11Bot Management and reCAPTCHA Enterprise

Not every harmful visitor is an exploit. Many are automated programs pretending to be people. Telling them apart is a different skill.

A bot is simply a program that does things on the internet automatically. Many bots are good: search engines use them to index your pages. Others are harmful. The hardest part is that harmful bots try hard to look human, using real browser identities and spreading their requests across thousands of addresses so no single one looks busy.

Ways Cloud Armor can help

Challenge

Redirect to a challenge

A rule can redirect a suspicious request to a reCAPTCHA challenge. Humans can pass, and simple scripts cannot.

Score

Action tokens

Your page can run reCAPTCHA Enterprise in the background when a visitor performs an important action, such as logging in. It produces a token and a score that estimates how human the visit looks. A Cloud Armor rule can then act on that score.

Session

Session tokens

A token that identifies a browsing session and stays valid for a time, which lets rules treat a vouched-for visitor differently from an unknown one without constant challenges.

Rate

Rate limits per client

Even smart bots slow down when each client is limited, so limits are a natural partner of bot rules.

A sensible bot defense plan

1

Find what is worth protecting

Login, checkout, sign-up, search, and pricing pages are common targets. Defend those first, not the whole site.

2

Measure normal behavior

Use logs to see how real visitors use these pages, so that thresholds are based on facts.

3

Add invisible checks first

Score visitors in the background. Most real people never see a challenge.

4

Challenge only when suspicious

Send low-score visitors to a visible challenge, and block those that fail repeatedly.

5

Keep good bots working

Allow search engines and trusted partners with explicit rules so you do not damage your visibility.

6

Keep watching

Bot makers adapt. Review the results regularly and adjust.

Everyday analogy

A bank does not ask every customer for a fingerprint. It quietly watches for odd behavior, such as someone who tries thirty different account numbers in a minute, and then asks only that person for extra proof of identity. Invisible scoring plus targeted challenges follow the same idea.

i
Tip

Remember accessibility. Visible challenges can be hard for some users, such as those who rely on screen readers. Prefer invisible scoring where possible, and offer a way for blocked real people to get help.

12DDoS Protection, Adaptive Protection, and the Service Tiers

Floods are the loudest attacks. Defending against them takes both huge capacity and clever detection.

Always-on protection against floods

Traffic that reaches your application through Google Cloud’s global load balancing passes through Google’s own front end infrastructure, which is built to absorb enormous floods. Attacks aimed at the lower network layers, such as volumetric and connection-setup floods, are filtered automatically at this front end. You do not have to switch this on or write rules for it. It is part of how the platform works.

In recent years the largest recorded web floods have reached tens and even hundreds of millions of requests per second, such as the HTTP/2 “rapid reset” attack disclosed in 2023, which Google publicly described as the largest of its kind at the time. Such numbers show why defenses must live in a very large shared network, not at a single company’s front door.

The application layer is harder

A flood of ordinary-looking requests aimed at your most expensive pages is much harder to detect than a flood of garbage. Cloud Armor’s rules, rate limits, and bot checks form your first lines of defense against them. And for larger organizations there is a smarter helper.

Adaptive Protection

Adaptive Protection uses machine learning to study the normal pattern of traffic to each protected service. When the pattern suddenly changes in a way that looks like an attack, it raises an alert, describes the suspicious traffic, and suggests a rule that would block it. In the enterprise tier you can allow it to deploy such rules automatically. This is valuable because it spots new attack shapes that no signature list knows about yet.

flowchart LR
    TR["Normal Traffic Patterns Learned"] --> DET{"Sudden Unusual Pattern?"}
    DET -->|"No"| CONT["Keep Monitoring"]
    DET -->|"Yes"| ALR["Alert with Attack Details"]
    ALR --> SUG["Suggested Blocking Rule"]
    SUG --> REV["Team Reviews and Deploys"]
    SUG --> AUTO["Optional Automatic Deployment"]
    REV --> BLK["Attack Traffic Blocked"]
    AUTO --> BLK
    
Figure 4: Adaptive Protection learns what normal looks like, flags unusual surges, and proposes rules to block them.

The service tiers

Cloud Armor Standard

  • Pay-as-you-go pricing
  • Security policies, rules, preconfigured WAF rules, rate limiting, and basic features
  • Fits most small and medium applications
  • No fixed subscription

Cloud Armor Enterprise

  • Subscription-based pricing
  • Adds Adaptive Protection alerting and suggested rules, and threat intelligence lists
  • Includes extra DDoS support and cost protection for floods, per the current terms
  • Fits large, high-value, or heavily targeted applications
Everyday analogy

Standard is like hiring trained guards for the door. Enterprise adds a control room with cameras and an expert watching the screens, who notices a sudden crowd forming down the street and tells the guards what to look for before the crowd arrives.

!
Watch out: the bill during an attack

When an attack hits, your traffic bill rises along with it, because requests are counted. Enterprise terms include protection against some attack-related charges, but you should read the current terms carefully. Whatever the tier, set billing alerts so a flood does not turn into a financial surprise.

13Rolling Out Safely: Preview, Tune, Enforce

The biggest fear with any firewall is blocking your own customers. A careful rollout removes most of that fear.

A security rule that is wrong can cause an outage as damaging as an attack. A checkout page that suddenly rejects every order because a signature disliked a coupon code costs real money. For that reason, experienced teams follow a repeatable process instead of switching rules on in a hurry.

flowchart TD
    A["Draft the rule"] --> B["Deploy in Preview Mode"]
    B --> C["Collect logs for several days"]
    C --> D{"Any false positives?"}
    D -->|"Yes"| E["Tune: opt out signatures, add exclusions, adjust level"]
    E --> B
    D -->|"No"| F["Enforce on a small share or one service"]
    F --> G["Watch errors and customer reports"]
    G --> H{"Healthy?"}
    H -->|"No"| I["Roll back to Preview"]
    I --> E
    H -->|"Yes"| J["Enforce everywhere and keep monitoring"]
    
Figure 5: The safe rollout loop. Preview, review, tune, enforce gradually, and always keep a quick way back.

The steps in plain words

1

Turn on logging first

You can only judge a rule if you can see its effect. Make sure request logging is enabled on the backend service before anything else.

2

Add rules in preview

Deploy each new rule in preview mode so it records its decisions and blocks nothing.

3

Wait long enough

Cover at least one full business cycle: weekdays, weekends, month-end billing runs, and any weekly batch jobs. Rare but legitimate behaviors only show up over time.

4

Read what would have been blocked

Group the logged matches by rule and by request path. Look hard at the ones that touch real customer actions.

5

Tune

Opt out of noisy signatures, exclude specific fields, or lower the sensitivity for particular paths. Re-run preview until it is quiet on real traffic.

6

Enforce in a small step

Switch enforcement on for one low-risk service first, or use a narrow condition. Monitor error rates and support tickets closely.

7

Keep a rollback ready

Know exactly how to flip the rule back to preview in seconds. Practice it before you need it.

Test with safe, controlled attacks

Once rules are enforced, check that they really work. In a test environment you own, send harmless sample attack-like requests and confirm they are denied with the expected response, while normal requests still succeed. Do this only against systems you are authorized to test, never against anyone else’s. Many teams add such checks to their release pipeline so a broken protection is noticed immediately.

Change management

  • Keep policies in code and require peer review for rule changes.
  • Record the reason for each rule in its description, so future staff know why it exists.
  • Schedule regular reviews to remove outdated rules, because old rules clutter the policy and hide problems.
  • Plan emergency changes in advance, such as a pre-approved procedure for quickly blocking an attacking range.
Everyday analogy

Introducing a new rule is like adding a new ingredient to a restaurant’s signature dish. A good chef tests it in a small batch, asks a few regulars what they think, adjusts the quantity, and only then puts it on the menu for everyone.

i
Tip

Never roll out rule changes on a Friday afternoon or right before a major sale. If something goes wrong, you want your whole team awake, present, and ready to respond.

14Performance, Scalability, and Availability

A security service that slows down or breaks your site is a bad bargain. Here is why Cloud Armor is designed to stay out of the way.

Speed

Cloud Armor’s checks are part of the load balancer’s own request handling and run inside Google’s network, so they add very little delay. Because rules are evaluated at the edge nearest the visitor, blocked requests are answered immediately, and allowed requests are not forced through a separate appliance in the middle of the path.

Scalability

There is no box with a maximum capacity to size, and no appliance to add when traffic grows. The protection scales with Google’s global load balancing infrastructure. When a sudden surge of visitors arrives, whether from a viral post or an attack, the same edge capacity handles it. You pay according to use, as covered in the cost chapter.

Availability

Because Cloud Armor is built into the load balancing layer, which is itself a distributed, highly available service, there is no single guard that can fall over. Policies are stored and distributed by Google to the edge locations, and a change you make is rolled out across the fleet after a short delay. Plan for that delay: do not expect a new rule to take effect in the same instant you save it.

Design effect

Policy size and complexity

Large numbers of rules and very complex expressions cost a little more time to evaluate and are harder for humans to maintain. Keep policies tidy.

Design effect

Body inspection limits

Only part of a request body is inspected. If very large uploads must be checked for malware, add a separate scanning step in the backend.

Design effect

Quotas

There are documented limits for rules per policy, policies per project, and rate-limit rules. Check them early when designing large setups.

Design effect

Fail-open or fail-closed

Think about what should happen if protection cannot decide. Most public sites prefer to stay available, while very sensitive systems prefer to be strict.

Protect the capacity behind the guard

Cloud Armor stops what it can recognize as bad. The traffic it lets through still needs servers to handle it. For a robust design, combine Cloud Armor with autoscaling, which adds servers when load rises, and with caching through Cloud CDN, so repeated requests for the same content are served from the edge without touching your servers at all. This pairing protects both your security and your budget.

Everyday analogy

A busy restaurant has a host at the door to turn away troublemakers, but it also needs enough tables and cooks for the real diners. The host keeps out the rowdy crowd, the kitchen team scales up for a rush, and a pre-prepared dish counter serves popular items instantly.

!
Watch out

A rule that allows a request after only a partial check does not mean the request is clean. Keep input validation, parameterized database queries, and output encoding in your application code. Cloud Armor is a second line of defense for these, not a replacement.

15Securing the Setup Itself: Lock the Back Door and Guard the Keys

A strong front door does not help if the back door is open. This chapter covers the most common ways teams accidentally bypass their own protection.

Layer 1: Make the load balancer the only way in

Cloud Armor only sees traffic that passes through its load balancer. If an attacker discovers the direct public address of a virtual machine or a serverless service, they can skip the guard entirely. Closing every other entrance is one of the most valuable things you can do.

VM

Virtual machines

Give backend machines no public address where possible, or use firewall rules that only accept traffic coming from the load balancer’s source ranges and health checkers.

RUN

Cloud Run

Set the service’s ingress setting so it accepts traffic only from internal sources and from the load balancer. Otherwise anyone can use the service’s default public web address and bypass your policy.

K8S

Kubernetes

Expose services through the managed ingress or gateway tied to the load balancer, and avoid giving services their own public load balancers that skip the policy.

EXT

External origins

If the backend lives outside Google Cloud, allow only Google’s load balancer source ranges at the origin, and consider requiring a secret header that the load balancer adds, which only genuine proxied requests carry.

Layer 2: Who may edit policies (IAM)

IAM, Identity and Access Management, controls who can do what in Google Cloud. Security policies are powerful: a person who can edit them can open your site to attacks or, just as easily, block all your customers. Roles such as the Compute Security Admin role are designed for managing security policies. Follow the rule of least privilege.

  • Give edit rights to a small, named security group, not to everyone in engineering.
  • Give read-only access to those who only need to view logs and rules.
  • Use separate automation accounts with narrow permissions for pipeline deployments.
  • Require approvals for changes to production policies.

Layer 3: Audit trails

Cloud Audit Logs record who created, changed, or deleted a security policy and when. Send these logs to a protected location and alert on unexpected changes, particularly rules that move traffic from deny to allow, or the removal of a policy from a backend service.

Layer 4: Protect the certificates and domain

Cloud Armor depends on the load balancer, which depends on your domain name and certificates. Guard your DNS and registrar accounts with strong sign-in, because someone who can change where your name points can send visitors around your protection altogether.

!
Watch out: the forgotten test endpoint

Teams often leave a development or staging copy of an application reachable on a public address with no policy attached. Attackers look for exactly these. Apply a baseline policy to every internet-facing endpoint, including those you consider temporary.

Everyday analogy

You can hire the best doorman in the city, but if the kitchen door at the back of the building is propped open, burglars will simply use that. Real protection means checking every door and window in the building, and also keeping the key cabinet locked.

16Monitoring, Logging, Metrics, and Cost

You cannot defend what you cannot see, and in a usage-based service you cannot manage costs you do not watch.

What to watch

Logs

Load balancer request logs

Each logged request records which security policy and rule matched, the action taken, and any preview rules that would have matched.

Metrics

Cloud Monitoring

Counts of allowed and denied requests per policy over time, for dashboards and alerts.

Detail

Verbose logging for WAF rules

A setting that records which exact signature fired and sometimes the offending part of the request, valuable for tuning. Use it with care because logs can contain sensitive data and take space.

Alerts

Adaptive Protection alerts

Notifications about suspicious traffic surges, with details and suggested rules, in the enterprise tier.

Central view

Security Command Center

Google Cloud’s security dashboard can collect findings from across your projects, giving security teams one place to look.

Changes

Audit logs

A record of who edited policies and rules.

Questions your dashboard should answer

  • How many requests are being denied, and is that number moving?
  • Which rules block the most traffic, and are they still useful?
  • Which source countries, networks, and paths are most targeted?
  • Are real customers hitting denies? Look at denied requests with ordinary-looking addresses and paths.
  • Did any preview rule record a very large number of matches that would have caused harm?

Alerts worth setting

  • A sudden jump in denied requests, which signals an attack or a faulty new rule.
  • A sudden drop in total requests, which may mean a rule is blocking customers.
  • An Adaptive Protection alert for any service.
  • Any change to a production security policy outside approved windows.
  • Spending that crosses a budget threshold.

How billing works

Cost driverWhat countsPlain-language tip
Security policiesA monthly charge for each policyShare baseline policies across services instead of copying them
RulesA monthly charge for each rule in a policyRemove outdated rules and combine similar ones
RequestsA charge per million requests evaluated by a policyCache static content so fewer requests reach evaluated paths
Enterprise subscriptionA subscription fee, plus data processing charges, for the enterprise featuresUse it for the applications that truly need it
LoggingLog ingestion and storage follow Cloud Logging pricesUse verbose logging only while tuning
Load balancerCharged separately by the load balancing serviceBudget for it with your application

For most applications, the cost of protection is small compared with the cost of one successful attack or one long outage. Exact prices change and depend on tier and usage, so read the current pricing page before estimating.

i
Tip

Review your rule list every quarter. Teams tend to add rules during incidents and never remove them. A rule that has not matched anything in months is probably dead weight and costs money.

17Integrations, Automation, and Daily Operations

Cloud Armor works best when it is part of the whole delivery chain and managed like the rest of your code.

Speed

Cloud CDN

Serve cached content from the edge. Pair a backend policy with an edge policy to filter requests even before the cache is consulted.

Serverless

Cloud Run and App Engine

Place serverless apps behind a load balancer using a serverless connection, so that a policy can protect them.

Containers

Google Kubernetes Engine

Attach a security policy to services exposed through the managed ingress or gateway, using the cluster’s configuration objects.

APIs

Apigee and API gateways

Protect API entry points with rate limits and WAF rules, in addition to the gateway’s own controls such as keys and quotas.

Bots

reCAPTCHA Enterprise

Supplies the scoring and challenge technology used for bot defense.

Oversight

Cloud Logging, Monitoring, and Security Command Center

Collect decisions, build dashboards and alerts, and give security teams a shared view.

Treat security policy as code

A policy edited by clicking in a console is hard to review and easy to break. Mature teams describe their policies in files stored in version control, using an infrastructure-as-code tool such as Terraform, and apply them through a reviewed pipeline. This gives history, peer review, easy rollbacks, and the ability to recreate the same policy for testing and for production.

1

Describe

Write the policy and its rules in files in a code repository, with a comment explaining each rule’s purpose.

2

Review

A teammate checks the change. Automated checks flag risky patterns, such as a broad allow rule at a very small priority number.

3

Plan

The tool shows exactly what will be added, changed, or removed before anything happens.

4

Apply in stages

Deploy first to a test environment, then to production, with new rules starting in preview mode.

5

Verify

Run automated test requests that confirm the policy blocks what it should and passes normal traffic.

An incident runbook

Prepare a written plan for the day an attack arrives, because during an attack nobody thinks clearly. A simple runbook lists who is on call, where dashboards and logs are, how to find the attack’s common features, which kinds of rules to add first, how to communicate with customers, and how to bring the situation back to normal. After each incident, review what worked and update the plan.

i
Tip

Keep a short list of pre-written emergency rules, such as “block this country from the login path” or “throttle the search path to a low rate”, already reviewed and ready to deploy. Writing rules under pressure is how mistakes happen.

18Advantages, Disadvantages, and Alternatives

Every tool has strengths and weak spots. Knowing both lets you choose with open eyes.

Advantages

  • Rules run at Google’s global edge, close to the attacker
  • Nothing to install, size, or patch
  • WAF, rate limiting, bot defense, and DDoS defense in one service
  • Preconfigured rules based on a respected community rule set
  • Preview mode makes safe rollout possible
  • Adaptive Protection finds new attack shapes
  • Works with many Google Cloud backends, including serverless and containers
  • Integrated logging, monitoring, and IAM

Disadvantages

  • Works best for traffic that goes through Google Cloud load balancers
  • Only an initial part of the request body is inspected
  • Preconfigured rules can cause false positives and need tuning
  • Costs grow with the number of rules and requests
  • Advanced features need the enterprise tier
  • Teams running several clouds must manage more than one WAF

The trade-offs behind the choice

Trade-off

Strict vs smooth

Higher sensitivity blocks more attacks and also more real people. Tune to the risk of each path.

Trade-off

Shared vs separate policies

A shared policy is consistent and cheap. Separate ones fit special needs but multiply maintenance.

Trade-off

Automation vs control

Auto-deployed rules react fast, but a human reviewing them avoids surprises.

Trade-off

Convenience vs lock-in

Deep integration saves effort, but keep rules in code and documented so moving remains possible.

How it compares with other options

OptionRoleShines atThink twice when
Google Cloud ArmorManaged WAF and DDoS defense at Google’s edgeApplications behind Google Cloud load balancersYour traffic mostly runs on another cloud
AWS WAF with AWS ShieldManaged WAF plus DDoS protection on AWSAWS-centered stacksYour workloads are mainly on Google Cloud
Azure Front Door and WAFManaged web entry point with a WAF on AzureAzure-centered stacksYour workloads are mainly elsewhere
Third-party edge security providersNetwork-level edge WAF and DDoS services that sit in front of any cloudMulti-cloud and on-premises mixes, with one consistent policyYou prefer a single-vendor setup with integrated billing and identity
Self-run WAF software on your machinesFor example, an open-source WAF engine on your own serversTotal control and unusual requirementsYou lack staff for tuning, patching, and capacity planning
Application-level checks onlyValidation and defenses inside your own codeEssential foundation for everyoneUsed as the only layer, it leaves you exposed to floods and fast-moving threats

Many organizations combine layers: secure code at the base, Cloud Armor at the edge, and monitoring on top. Some also keep a third-party edge in front for a single policy across several clouds. Choose a design that your team can actually operate well.

19Design Patterns and Anti-Patterns

Teams keep solving the same protection problems. Here are the patterns that work, and the traps that catch people.

Patterns that work

Pattern

Baseline policy

One shared policy with standard WAF bundles, a modest rate limit, and known-bad blocks, attached to every internet-facing service.

Pattern

Layered priorities

Allow exceptions first, then blocks, then WAF, then rate limits, with default rule last. Spaced numbers for easy insertion.

Pattern

Strict where it matters

Higher sensitivity and tight rate limits on login, payment, and admin paths. Gentler settings elsewhere.

Pattern

Preview before enforce

Every new rule begins as a silent observer, then is enforced in stages.

Pattern

Closed back door

Backends accept traffic only from the load balancer, so the policy cannot be bypassed.

Pattern

Policy as code

All rules in version control, reviewed, tested, and deployed by a pipeline.

Anti-patterns to avoid

ANTI-PATTERN 01Avoid
What it looks like

Turning on every WAF bundle at the highest sensitivity in enforcement mode on day one.

Why it hurts

False positives block real customers, support calls pile up, and the team panics and switches the whole policy off, which leaves the site less protected than before.

Do this instead

Start in preview at a modest level, tune from real logs, and raise sensitivity gradually where the risk justifies it.

ANTI-PATTERN 02Avoid
What it looks like

A policy attached to the load balancer while the backends still have public addresses that accept direct traffic.

Why it hurts

Attackers find the direct addresses and bypass every rule. The policy looks perfect on paper and protects nothing.

Do this instead

Restrict backends to accept traffic only from the load balancer and its health checkers.

ANTI-PATTERN 03Avoid
What it looks like

Blocking or rate limiting by the address of a proxy in front of the load balancer, instead of the real client address.

Why it hurts

All visitors look like one client. A rate limit then locks out everyone together, or a block hits the entire audience at once.

Do this instead

Configure Cloud Armor to read the true client address from the correct forwarded header.

ANTI-PATTERN 04Avoid
What it looks like

A growing pile of one-off emergency rules, never reviewed and never removed.

Why it hurts

The policy becomes confusing, expensive, and full of conflicting priorities. Nobody remembers why rules exist, so nobody dares to delete them.

Do this instead

Describe each rule’s purpose, set review dates, and remove rules that no longer match anything useful.

20Best Practices, Common Mistakes, and Troubleshooting

A practical checklist, followed by a simple method for working out why a request was blocked or allowed.

Best practices

1

Defend in layers

Keep secure code, patched systems, and least-privilege access. Treat Cloud Armor as the edge layer, not the only one.

2

Enable logging before anything else

Without logs you are guessing about every rule.

3

Preview, tune, enforce

Roll out every rule in stages with a ready rollback.

4

Close the back door

Allow backends to be reached only through the load balancer.

5

Defend the high-value paths harder

Login, payment, sign-up, and admin areas deserve stricter settings and rate limits.

6

Get the client address right

Make sure Cloud Armor sees the real visitor behind any proxies.

7

Manage policy as code

Review, test, and deploy rules through a pipeline, with documented reasons.

8

Watch, alert, and rehearse

Build dashboards and alerts, keep a runbook, and practice responding to an attack.

Common mistakes

  • Forgetting the rule order. A broad deny with a small number can catch the traffic you meant to allow.
  • Relying on geography alone. Location from an address is approximate, and attackers can use addresses anywhere.
  • Rate limits set too low. Legitimate mobile apps and busy offices are blocked.
  • Ignoring false positives. Customers quietly fail to check out, and no one notices until revenue dips.
  • Attaching the policy to the wrong service. The rules are correct, but the service that matters is not protected.
  • Leaving staging endpoints open. Attackers use them to find weaknesses and as stepping stones.
  • Assuming a saved rule works instantly. There is a short delay while changes spread across the edge.
  • Treating the WAF as a substitute for patching. Known flaws still need real fixes.

A simple troubleshooting path

flowchart TD
    A["A request was blocked or allowed unexpectedly"] --> B["Find the request in the load balancer logs"]
    B --> C["Read the matched policy and rule"]
    C --> D{"Is the matched rule the one you expected?"}
    D -->|"No"| E["Look for an earlier rule with a smaller priority number"]
    D -->|"Yes"| F{"Is it a WAF signature?"}
    F -->|"Yes"| G["Turn on verbose logging, find the signature, opt out or exclude the field"]
    F -->|"No"| H["Check the expression, the client address source and the rate-limit key"]
    E --> I["Adjust priorities or add a narrow exception"]
    G --> J["Retest in preview mode"]
    H --> J
    I --> J
    
Figure 6: A step-by-step path for working out why a request was handled the way it was.
A

Capture an example

Get the time, the path, and the client address from the user or the log search.

B

Read the decision record

The log entry names the policy and rule that decided the outcome, and lists preview matches separately.

C

Check priorities

Remember that the lowest number that matches wins. An unexpected result usually means another rule matched earlier.

D

Fix narrowly

Prefer a small exception or one signature opt-out over broad changes that weaken protection.

E

Retest and document

Confirm in preview, deploy, and write down why the change was made.

21Real-World Usage Scenarios

These illustrative scenarios show how the ideas combine in typical organizations. They are teaching examples, not descriptions of specific companies.

An online shop prepares for its biggest sale of the year

The team enables the baseline policy with moderate WAF sensitivity, adds a strict rate limit and bot scoring on the login and checkout paths, and caches product images through Cloud CDN. They rehearse an attack response plan and set budget alerts. During the sale, a wave of scraping bots is throttled, a burst of password-guessing is banned automatically, and real shoppers notice nothing.

A bank protects its login and payment pages

The bank places its web applications behind a global load balancer with a strict policy: high WAF sensitivity on sensitive paths after long preview periods, threat intelligence lists to block anonymizing exit points, and reCAPTCHA Enterprise scoring on login. Admin pages accept only the bank’s office and VPN ranges. Backends accept traffic only from the load balancer, and every policy change goes through reviewed code with approvals.

A startup launches a public API

The startup serves an API from containers behind a load balancer. Rate limits keyed by an API key header give every customer a fair share, and a global ceiling protects the database. WAF bundles for injection are enabled, and rules block requests with unexpected methods. As usage grows, the team reviews logs weekly to tune limits for their heaviest legitimate customers.

A news site survives a flood of traffic

A news site is hit by a sudden surge of requests that look like normal page views but ask for uncached search results. Adaptive Protection flags the unusual pattern and suggests a rule matching the shared traits of the attack. The team reviews the suggestion, deploys it, and the flood is blocked at the edge while editors keep publishing.

A company serves only one country

A regional service is legally allowed to operate only in one country. A geographic rule denies requests from elsewhere, with an exception for the company’s own offices abroad and for known search engine crawlers. Because location is approximate, they do not rely on the rule alone and also keep rate limits and WAF rules in place.

A team protects a serverless application

An app on Cloud Run is placed behind a global load balancer. The service’s ingress is set to accept only internal and load balancer traffic, so its default public address no longer works. A baseline Cloud Armor policy now protects it, and the team discovers through preview logs that an old mobile app version sends an unusual header that a custom rule wrongly flagged, which they fix before enforcement.

22Frequently Asked Questions

Quick answers to the questions beginners ask most often.

Q1What is Cloud Armor in one sentence?
It is Google Cloud’s managed web application firewall and DDoS defense service, which checks requests at Google’s edge against your security policy before they reach your applications.
Q2Do I need to install or run anything?
No. You create policies and attach them to backend services. Google runs the infrastructure that enforces them.
Q3Which rule wins when several match?
The rule with the smallest priority number that matches. Cloud Armor stops checking after the first match.
Q4What is preview mode?
A mode in which a rule is evaluated and logged but does not block anything. It lets you see the real effect of a rule before enforcing it.
Q5Will the WAF block my real customers?
It can, through false positives, especially at high sensitivity. Preview first, tune using the logs, and enforce in stages.
Q6Does Cloud Armor protect against all DDoS attacks?
Google’s global infrastructure absorbs very large floods, and Cloud Armor rules, rate limits, and Adaptive Protection help against application-layer attacks. No service can promise to stop every possible attack, so combine protection with autoscaling, caching, and a response plan.
Q7Can I use it for services that are not on Google Cloud?
Yes, in many cases, if the traffic enters through a Google Cloud external load balancer that fronts the outside backend. Check the current documentation for supported backend types.
Q8Why can attackers still reach my server directly?
Because the backend still accepts traffic on its own public address. Restrict it to accept traffic only from the load balancer, and for Cloud Run set the ingress setting accordingly.
Q9What is the difference between throttle and rate-based ban?
Throttle rejects only the requests above the limit, and a client that slows down is served again. A rate-based ban blocks all requests from a client for a set time once it exceeds a higher limit.
Q10Does Cloud Armor read encrypted traffic?
Yes, because the secure connection ends at the load balancer, which can read the request for evaluation. This is why the policy attaches to the load balancer, not to the backends.
Q11How quickly does a new rule take effect?
Changes spread across Google’s edge locations after a short delay. Plan for that delay and do not assume instant effect.
Q12Is the enterprise tier necessary?
Not for most small and medium applications. It adds Adaptive Protection alerting, threat intelligence lists, and extra DDoS support, which suit large, high-value, or heavily targeted services.
Q13Can I use geography to block countries?
Yes, using region codes in rules, but treat it as a coarse filter since location from an address is approximate and can be disguised.
Q14Is a WAF enough to keep my application secure?
No. It is one layer. You still need secure code, timely patching, strong access control, and monitoring.

23Summary and Key Takeaways

If you remember only a few things from this guide, remember these.

Cloud Armor is Google Cloud’s managed web application firewall and DDoS defense, applied at the edge of Google’s global network through your load balancers. You write a security policy made of prioritized rules, use ready-made WAF bundles for common attacks, add custom rules and rate limits for your own risks, and bring in bot scoring and Adaptive Protection where the stakes are higher. Used well, it quietly removes most hostile traffic before it ever touches your servers.

A firewall is only as good as its rollout: watch first, tune carefully, and enforce with a way back.

Key Takeaways

  • Edge protection. Cloud Armor evaluates requests at Google’s edge through the load balancer, so bad traffic is stopped far from your servers.
  • Rules run in order. The smallest priority number is checked first, the first match decides, and the default rule catches the rest.
  • Preview before enforcing. Roll out rules in preview, tune using real logs, enforce in stages, and keep a fast rollback.
  • Use ready-made WAF bundles wisely. Pick sensitivity by risk, expect false positives, and tune with opt-outs and exclusions, not by switching protection off.
  • Limit and challenge abuse. Use rate limits for floods and password guessing, and bot scoring with reCAPTCHA Enterprise for automated abuse.
  • Close the back door. Make the load balancer the only way into your backends, and give policy editing rights to a few trusted people.
  • Operate it like code. Keep policies in version control, watch logs and alerts, review rules regularly, and prepare an attack runbook.