Cloud Armor in Google Cloud: A Shield in Front of Your Applications
A thorough, plain-English guide to Google's managed web application firewall and DDoS defense service, covering security policies and rule priorities, preconfigured WAF rules, rate limiting, bot management, Adaptive Protection, edge policies, logging, tiers and cost, and the habits that let you block attackers without blocking customers.
Imagine a popular concert hall with one grand entrance. On a normal night, guests stroll in. On a bad night, a huge mob rushes the doors, some people try to sneak in with fake tickets, and a few carry things they should not. If the hall’s staff stood only inside, the chaos would already be in the lobby. So the hall puts trained guards outside, far from the doors. They check tickets, turn away troublemakers, slow the crowd to a manageable trickle, and recognize regular troublemakers by their faces, all before anyone reaches the staff. Cloud Armor is that line of guards for your applications. It sits at the edge of Google’s network, in front of your load balancers, and inspects every request before your servers ever see it. This guide explains how the guards are organized, how you give them instructions, and how to keep them effective without turning away honest guests.
1What Cloud Armor Really Is
Before diving into rules and policies, we need a clear picture of the problems this service addresses and the place it holds in the architecture.
The threats on the internet
Any application reachable from the internet is constantly probed. Some attacks aim to knock the application offline by overwhelming it with traffic, known as distributed denial of service, or DDoS. Others try to trick the application into misbehaving by sending specially crafted input, such as attempts to inject database commands or hostile scripts. Others use automated programs, called bots, to scrape content, guess passwords, or abuse features at scale. A few simply come from places or networks you never intended to serve.
Defending against all of this inside the application itself is difficult and wasteful. Your servers would spend precious capacity inspecting and rejecting hostile traffic, and every team would have to reinvent the same protections. It is far better to stop bad traffic at the edge, before it reaches the servers.
What the service gives you
Cloud Armor is Google Cloud’s managed web application firewall, often shortened to WAF, together with DDoS protection. You attach security policies to your load balancer backends. Each policy is a set of rules that decide whether to allow, deny, throttle, or challenge each request. The rules are evaluated at the edge of Google’s global network, so malicious traffic is stopped close to where it enters, using the same infrastructure Google uses to protect its own services. You get preconfigured rules for common web attacks, rate limiting, bot management, geography and address filters, and machine-learning-based defenses, all without running any firewall hardware.
Think of airport security. Passengers pass through checkpoints before reaching the gates. Some checkpoints look at documents, some scan bags, and some check a watch list. The gates and aircraft are never exposed to anyone who has not passed through. Cloud Armor is the security checkpoint in front of your application’s gates.
Cloud Armor protects traffic that flows through supported load balancers. It is one layer of defense, not the only one. It does not replace secure coding, patching, authentication, or network firewalls inside your private networks. Use it alongside those controls.
2Core Concepts and Vocabulary
Every security product has its own words. These are the ones you will meet in nearly every Cloud Armor conversation.
Security Policy
A named collection of rules that you attach to a backend service. It is the main object you create and manage.
Rule
One instruction inside a policy: a condition to match, an action to take, and a priority number that sets its order.
Priority
A number on each rule. Lower numbers are checked first, and the first rule that matches decides the outcome.
Action
What happens when a rule matches: allow, deny with a chosen error code, throttle, ban temporarily, or redirect for a challenge.
WAF
A web application firewall. It inspects web requests for patterns that look like attacks, such as injection attempts.
Preview Mode
A setting that lets a rule log what it would have done without actually blocking anything, used to test safely.
Rate Limiting
Controlling how many requests a client may send over a period, to stop floods, scraping, and password guessing.
Adaptive Protection
A machine-learning feature that learns your normal traffic and flags and suggests defenses against unusual high-volume attacks.
Edge Security Policy
A policy applied at the edge to cached content, filtering requests before they are served from the cache.
Named IP List
A curated, maintained list of address ranges, which a rule can use to allow or deny traffic from known sources.
How the words fit together
You create a security policy and fill it with rules. Each rule has a match condition, an action, and a priority. You attach the policy to a backend service of a load balancer. When a request arrives, Cloud Armor checks the rules from the lowest priority number upward. The first rule whose condition matches decides what happens. If nothing matches, a default rule at the end applies. Preview mode lets you try rules safely, and logs let you see what happened.
Think of a bouncer holding a numbered checklist. Rule one says “turn away anyone on the banned list.” Rule two says “let in the staff.” Rule three says “check bags for prohibited items.” The bouncer works down the list and acts on the first line that fits the person at the door. The order of the list is everything.
A lower priority number means the rule is checked earlier, which is the opposite of what the word “low” might suggest. Rule 100 is evaluated before rule 1000. Forgetting this is one of the most common causes of rules that seem to do nothing.
3Architecture: Where Cloud Armor Sits
To use Cloud Armor well, you must understand where in the traffic path it acts and which load balancers it protects.
In the path of every request
Cloud Armor works together with Google Cloud load balancers. A request from a user travels over the internet and enters Google’s network at a point of presence near the user. For global external load balancers, the request meets the load balancing front end at that edge location, where security policies are evaluated. Only requests that pass the policy are forwarded to your backends, such as virtual machines, containers, serverless services, or storage buckets. Blocked requests never reach your servers, so they cost you no backend capacity.
flowchart LR
U["Internet users and attackers"] --> E["Google edge"]
E --> LB["Load balancer front end"]
LB --> SP{"Cloud Armor security policy"}
SP -->|"Allowed"| BE["Backend service"]
SP -->|"Denied or throttled"| BL["Blocked response"]
BE --> APP["Your application"]
Supported attachment points
Security policies attach to backend services of supported load balancers, including the external Application Load Balancers, the regional internal Application Load Balancer, and certain proxy network load balancers. Different features are available with different load balancer types, so check the current compatibility documentation when choosing. Network-level DDoS protections also exist for workloads that use external network load balancers, protocol forwarding, and virtual machines with public addresses.
| Layer | What it protects | Typical defense |
|---|---|---|
| Network and transport layers | Network load balancers, public virtual machines | Always-on network DDoS mitigation, advanced network DDoS protection |
| Application layer | Web traffic through application load balancers | Security policies with WAF rules, rate limits, bot management, Adaptive Protection |
| Cached content at the edge | Content served by CDN or from storage buckets | Edge security policies |
Picture a castle with several defenses. There is a moat against crowds, which is network DDoS defense. There is a gatehouse with guards who read documents, which is the application layer policy. And there is a separate checkpoint at the market stall outside the walls, which is the edge policy for cached goods.
Hybrid and multi-cloud reach
Because the policy sits on the load balancer, the backends behind it can be anywhere the load balancer can reach, including endpoints outside Google Cloud, in setups that use internet or hybrid network endpoint groups. This allows organizations to apply one consistent firewall layer across applications that are spread across several environments.
Make sure your backends accept traffic only from the load balancer. If attackers can reach your servers directly by address, they bypass Cloud Armor entirely. Restrict backend firewall rules so only load balancer sources are allowed in.
Which features work with which load balancer types changes over time. Always confirm compatibility in the official documentation before designing around a specific feature and load balancer pairing.
4Security Policies, Rules, and Priorities
The heart of Cloud Armor is the policy. Learning how rules are matched and ordered is the single most valuable skill.
Anatomy of a rule
Match condition
Describes which requests the rule applies to, based on address ranges, geography, headers, paths, or expressions in a custom rules language.
Action
States what to do with matching requests, such as allow, deny with a chosen error code, throttle, or ban for a time.
Priority
A number that sets the order in which rules are checked. The first matching rule wins and later rules are not consulted.
Preview setting
Optionally marks the rule as preview, so it logs what it would do without enforcing the action.
Description
A short note, limited in length, explaining why the rule exists. Keep references to a longer record elsewhere.
The default rule
Every policy has a default rule with the lowest possible precedence. It applies when no other rule matches. You decide whether the default is to allow traffic, which suits most public websites, or to deny traffic, which suits tightly controlled applications that should only be reachable by known sources. Choosing the default deliberately is one of the first design decisions.
A recommended rule ordering
A sensible structure is to arrange rules in broad groups. Explicit deny rules for unwanted address ranges, regions, or networks come first, because there is no reason to inspect traffic you already know you do not want. Next come narrowly trusted allow rules, for example for security scanners or trusted partner systems, used with great caution. Then come the security rules, such as the preconfigured WAF rules and custom rules that inspect content. After those, broader allow rules, for example for known networks or particular header values. Finally, the default rule decides everything left.
flowchart TD
R["Incoming request"] --> A{"Explicit deny rules match?"}
A -->|"Yes"| X["Deny"]
A -->|"No"| B{"Trusted allow rules match?"}
B -->|"Yes"| OK["Allow"]
B -->|"No"| C{"Security rules like WAF match?"}
C -->|"Yes"| X
C -->|"No"| D{"Broader allow rules match?"}
D -->|"Yes"| OK
D -->|"No"| E["Default rule decides"]
Think of a security checklist at a building entrance. First, turn away anyone on the banned list. Then let in the pre-approved visitors. Then inspect bags for dangerous items. Then admit regular visitors with a valid pass. Anyone left over is handled by the building’s default policy.
Priority spacing
Leave gaps between priority numbers, for example by tens or hundreds, rather than numbering rules one, two, three. Later you will need to insert a rule between two existing ones, and without gaps you would have to renumber many rules and risk mistakes. Spacing is a tiny habit that saves painful rework.
A broad allow rule placed above a security rule means attackers matching the allow are never inspected. A broad deny placed too early can block trusted partners. Always walk through your rule list in priority order and ask what each type of request would meet first.
Write a short description on every rule and keep a longer explanation in your configuration records. When an incident happens months later, the person on call will thank you for knowing why a rule exists.
5Preconfigured WAF Rules and Custom Rules
Cloud Armor includes ready-made protections for common web attacks, plus a flexible language for your own rules.
Preconfigured WAF rules
Preconfigured WAF rules are collections of signatures for known attack patterns, assembled from open industry standards and aimed at the most common web vulnerabilities, including the well-known OWASP Top 10 list. They cover categories such as SQL injection, cross-site scripting, local and remote file inclusion, remote code execution attempts, protocol attacks, scanner detection, and session fixation. You turn them on by referencing them in a rule, instead of writing signatures yourself.
SQL injection
Detects attempts to smuggle database commands into input fields, URLs, or headers.
Cross-site scripting
Detects hostile scripts embedded in requests meant to run in other users’ browsers.
File inclusion
Detects attempts to trick the server into reading local files or loading remote code.
Remote code execution
Detects patterns that try to make the server run attacker-supplied commands.
Scanners and protocol attacks
Detects well-known scanning tools and malformed requests that probe for weaknesses.
Session and method abuse
Detects session fixation attempts and unusual or unexpected request methods.
Sensitivity levels
Each preconfigured rule set can be applied at a chosen sensitivity level. A lower sensitivity catches only the most clear-cut attacks and produces fewer false alarms. A higher sensitivity includes more signatures, catching subtler attacks but also flagging more legitimate requests that merely look suspicious. The right level depends on how sensitive your application is and how much tuning time you have. Many teams start at a lower level, observe the results, and raise it as they learn.
Stable and canary rule sets
There are two flavors of the managed rule sets. The stable version changes rarely and predictably, which suits production. The canary version receives newer signatures earlier, which lets you test upcoming changes before they reach the stable set. A cautious approach is to run canary rules in preview mode alongside stable ones so you can see what would change before it affects real traffic.
flowchart LR
NEW["New and updated signatures"] --> CAN["Canary rule set"]
CAN -->|"Tested in preview"| STB["Stable rule set"]
STB --> PROD["Production enforcement"]
CAN -.->|"Logs only"| LOGS["Review what would change"]
Tuning to avoid false positives
Real web applications sometimes send data that happens to match attack signatures. A rich text editor may submit HTML, a developer portal may accept code snippets, and a search box may include symbols that resemble injection attempts. Rule tuning lets you disable individual noisy signatures, or exclude certain request parts, so that legitimate users are not blocked while the rest of the protection stays active.
A smoke detector placed near the kitchen goes off whenever you toast bread. You do not remove the detector. You move it or adjust its sensitivity so it still catches real fires but ignores the toaster. WAF tuning is the same: keep the protection, quiet the false alarms.
JSON parsing
Modern applications often send data as JSON in request bodies. If body parsing for JSON is not enabled, the WAF rules may treat the body as a plain blob of text, producing noisy matches and false positives. Enabling JSON parsing lets the rules understand the structure of the data and reduces needless blocking, so it is usually worth enabling for applications that exchange JSON.
Custom rules language
Beyond the preconfigured sets, you can write your own match conditions using an expression language. You can combine conditions on source address, region, request path, headers, query parameters, and other attributes with logical operators. This is how you express business-specific rules, such as allowing an administrative path only from your corporate network, or denying requests that carry a certain unwanted header.
| Kind of rule | Best for | Effort |
|---|---|---|
| Preconfigured WAF rule | Common web attacks across any application | Low, with some tuning |
| Address or region rule | Allowing or blocking known networks or places | Low |
| Named IP list rule | Using curated lists of known sources | Low |
| Custom expression rule | Application-specific logic | Medium, needs careful testing |
Signature-based rules can be evaded and can miss new attacks. Treat the WAF as an important layer that reduces risk and buys time, but keep fixing vulnerabilities in the application itself.
6Rate Limiting and Abuse Control
Not all abuse looks like an attack signature. Sometimes the problem is simply too many requests from one client.
Why rate limiting matters
Some harmful behavior consists of perfectly normal-looking requests sent in huge numbers: guessing passwords one after another, hammering a login page, scraping every product page, or flooding an expensive search feature. No single request looks malicious. The pattern is the problem. Rate limiting counts requests from a client over a time window and reacts when the count passes a threshold you set.
Throttle and ban
Throttle
Allows requests up to a limit and rejects the excess, so a client that goes too fast is slowed down but may continue at the permitted pace.
Rate-based ban
When a client exceeds a higher threshold, it is blocked entirely for a set period, which discourages persistent abusers.
Choosing what to count
A rate limit must decide who counts as one client. Counting by source address is the simplest, but many legitimate users can share one address, such as an office or a mobile network, and attackers can change addresses. Other keys let you count by something more specific, such as the request path, a particular header or cookie value, the region, or the server name in the connection. Choosing a sensible key keeps legitimate shared-address users from being punished and makes evasion harder.
| Counting key | Good for | Watch out for |
|---|---|---|
| Source address | General flood protection | Shared addresses may block innocent users |
| Request path | Protecting a specific expensive endpoint | Needs correct path matching |
| Header or cookie value | Tracking sessions or API keys | Attackers can rotate the value |
| Region | Limiting traffic from a geography | Coarse, affects all users in that region |
| Combination of keys | Precise control | More complex to design and test |
Think of a ticket counter that allows each customer a few tickets per minute. If someone rushes back in line again and again, the clerk slows them down. If they keep trying, the clerk bans them for an hour. The challenge is deciding how to recognize “the same customer” when many people wear similar coats.
Setting thresholds well
Learn normal behavior
Study logs to see how many requests a typical legitimate client makes in the chosen window.
Start in preview
Deploy the rule in preview mode to see who would have been limited, without actually blocking anyone.
Pick a threshold above normal
Set the limit comfortably above legitimate peaks so real users are never affected, yet low enough to stop abuse.
Mind rule priority
Remember that a higher priority allow or deny rule may decide a request before it ever reaches the rate limit rule.
Enforce and watch
Turn on enforcement, monitor the effect, and adjust as traffic patterns change.
Rate limiting applied specifically to login and password reset paths is one of the most effective defenses against credential stuffing, where attackers try huge lists of stolen passwords. Pair it with strong authentication on the application side.
7Bot Management and Adaptive Protection
Some threats are automated clients pretending to be people, and some attacks are so large and odd that fixed rules cannot anticipate them. Two features address these.
Bot management
Bots range from helpful, such as search engine crawlers, to harmful, such as scrapers, fraud tools, and account takeover scripts. Cloud Armor integrates with a reCAPTCHA product designed for protecting websites and applications, so that decisions about whether a visitor is a human or a bot can be made at the edge and used inside your rules. A rule can, for example, allow requests that carry a valid token showing the visitor passed a check, redirect suspicious visitors to a challenge, or deny those that look automated. Because this happens at the edge, bots are stopped before they consume backend capacity.
sequenceDiagram
participant V as Visitor
participant E as Edge with Cloud Armor
participant R as Bot detection service
participant B as Backend
V->>E: Request without valid token
E-->>V: Redirect to challenge
V->>R: Complete challenge
R-->>V: Issue token
V->>E: Request with token
E->>E: Verify token and evaluate rules
E->>B: Forward legitimate request
B-->>V: Response
Think of a theme park that asks visitors to show a wristband before entering rides. Anyone without one is sent to the ticket desk to prove they paid. Staff at the ride never have to argue with gate crashers, because the check happens at the entrance.
Adaptive Protection
Adaptive Protection is a machine-learning feature that watches the normal pattern of traffic to your applications and learns what usual looks like. When it detects a sudden, unusual surge that looks like an application-layer DDoS attack, it raises an alert, describes the suspicious pattern, and suggests a rule you can deploy to block it. It can adapt to attacks that no pre-written signature would catch, because it compares traffic against your own baseline rather than a universal list.
Learn the baseline
The model observes your traffic over time to understand what normal looks like for each protected service.
Detect an anomaly
A sudden rise in traffic that deviates from the baseline in suspicious ways triggers an alert.
Describe the attack
The system identifies shared characteristics of the suspicious requests, such as common headers or paths.
Suggest a rule
It proposes a rule that would block the attack traffic while sparing normal users, which you can review and apply.
Adaptive Protection is best suited for high-volume attacks. Low-and-slow attacks that stay within normal volume may not trigger it. Use it together with WAF rules, rate limiting, and bot management, not as a replacement for them. Set up alerting so that the right people hear about detected attacks.
Advanced network DDoS protection
For workloads that use external network load balancers, protocol forwarding, or virtual machines with public addresses, there is an additional protection for volumetric network and protocol attacks. It provides always-on detection and mitigation, with extra visibility into attacks. Google Cloud’s global infrastructure already absorbs a very large amount of attack traffic by default, and this feature adds more tailored defense and telemetry for the resources you choose to protect.
| Threat | Best defense |
|---|---|
| Attack signatures such as injection and scripting | Preconfigured WAF rules |
| One client sending too many requests | Rate limiting |
| Automated scraping, fraud, and password guessing | Bot management and rate limiting on sensitive paths |
| Sudden high-volume application attack | Adaptive Protection and rate limits |
| Volumetric network and protocol attacks | Network DDoS protection |
8Edge Policies, Geography Filters, and IP Lists
Besides inspecting content, Cloud Armor can decide who may reach you based on where they come from, and it can protect cached content before it is ever served.
Geography and network rules
You can allow or deny traffic based on the region the request appears to originate from, or on the autonomous system, which identifies the network operator that owns the source address. These controls are valuable for applications that serve a single country, for meeting legal restrictions, or for cutting off regions where you have no customers but plenty of abuse. Because address-to-location mapping is never perfect, geography rules should be treated as a coarse filter and not a precise one, and people using certain networks may appear to be elsewhere.
Named IP lists
Named IP lists are curated collections of address ranges maintained by third-party providers and made available for use in rules. For example, a list might represent the ranges of well-known content networks or other recognized sources. Using such a list lets you allow or deny large, changing sets of addresses with a single rule, without maintaining the ranges yourself.
Address ranges
Allow or deny specific ranges, for example your offices or partner networks, or ranges that have abused your service.
Region codes
Allow or deny by the apparent country or region of the source, as a coarse business or legal control.
Network operator
Filter by the autonomous system, which can target abusive hosting providers or limit access to specific operators.
Curated lists
Use maintained lists of known address sets so you do not need to track changes yourself.
Edge security policies for cached content
When content is served from the edge cache, such as through a content delivery network or from storage buckets, a request can be answered without ever reaching your backend. Edge security policies apply filtering and access control to that cached content, so that you can restrict who may fetch it, for example by blocking certain regions or addresses, before it is served. This matters because cached assets are often the largest volume of traffic and would otherwise bypass backend-focused rules.
flowchart LR
U["User request"] --> ES{"Edge security policy"}
ES -->|"Blocked"| BL["Rejected at the edge"]
ES -->|"Allowed"| CACHE{"Content in cache?"}
CACHE -->|"Yes"| SERVE["Served from cache"]
CACHE -->|"No"| BP{"Backend security policy"}
BP -->|"Allowed"| BE["Fetch from backend or bucket"]
BP -->|"Denied"| BL
A library has a front desk that checks membership before anyone can browse the shelves of popular books, which are the cached items. Only when someone asks for a rare book kept in the archive, the backend, does a second check happen. Having both checks closes gaps that either alone would leave.
Regional blocking relies on mapping addresses to places, which can be wrong, and people use VPNs and mobile networks that appear elsewhere. Use geography to reduce noise, not as a guarantee, and do not use it as your only protection for sensitive operations.
9Logging, Monitoring, and Tuning
A firewall you cannot see into is a firewall you cannot trust. Cloud Armor provides the visibility you need, and the best teams use it constantly.
Request logs
Cloud Armor decisions appear in the load balancer’s request logs in Cloud Logging. Each log entry records which policy and rule applied, what the outcome was, and details of the request. For rules in preview mode, the logs show what would have happened. By searching these logs, you can answer questions such as which rule blocked a particular customer, which signatures fire most often, and where attacks are coming from.
Verbose logging for tuning
For WAF rules, a more detailed logging level can reveal exactly which signature matched and which part of the request triggered it. This is invaluable when tuning false positives, but it generates more log volume and may include more request data. It is meant for short tuning periods, not for permanent use in production.
Metrics and dashboards
Metrics about policy decisions flow into Cloud Monitoring, where you can build dashboards and alerts. You can also see suspicious traffic patterns surfaced in the central security dashboard of Google Cloud. A good dashboard shows allowed versus denied requests, the top rules by hits, the top sources, and any sudden changes.
Denied request rate
A sudden jump may mean an attack, or a new rule blocking real customers. Investigate either way.
Top matching rules
Shows which protections are doing the work and which noisy signatures need tuning.
Top sources
Reveals addresses, networks, or regions behind most of the blocked traffic.
Preview matches
Shows what a rule would have blocked, which is the safest way to judge its impact.
Adaptive Protection alerts
Notifications about suspected high-volume attacks and the rules it suggests.
Backend load and latency
Confirms whether the protections are actually shielding your servers during an attack.
The safe rollout loop
flowchart TD
A["Write or change a rule"] --> B["Deploy in preview mode"]
B --> C["Watch logs for would-be matches"]
C --> D{"Any legitimate traffic affected?"}
D -->|"Yes"| E["Tune the rule or exclusions"]
E --> B
D -->|"No"| F["Enable enforcement"]
F --> G["Monitor dashboards and alerts"]
G --> A
Before a new traffic light goes live, engineers run it in a flashing test mode and watch how cars behave. Only when they are sure it will not cause jams do they switch it to full operation. Preview mode is that flashing test mode for your rules.
Create an alert for sudden increases in denied traffic and for sudden drops in total traffic. A new rule that quietly blocks a large share of real customers shows up as a drop in successful requests, often before anyone complains.
Detailed logs can include request details. Restrict who can read them, set suitable retention, and avoid keeping verbose logging on longer than necessary.
10Working with GKE, Serverless, and Infrastructure as Code
Cloud Armor attaches to load balancers, so using it with containers and serverless services means understanding how those services sit behind load balancers.
Containers on Kubernetes
For applications running on Google Kubernetes Engine and exposed through the platform’s ingress, a configuration resource can reference a Cloud Armor security policy so that the generated load balancer backend carries it. This keeps protection tied to the way the application is exposed, and lets platform teams manage policies centrally while application teams simply reference them.
Serverless backends
Serverless services can sit behind a global external Application Load Balancer through a special backend type, which allows Cloud Armor policies to protect them. This is useful because serverless services otherwise expose a direct address that bypasses load balancer protections. To make the protection effective, restrict the serverless service so it accepts traffic only through the load balancer, which prevents attackers from reaching it directly.
Policies as code
Security policies are configuration, and configuration belongs in version control. Define policies and rules with infrastructure-as-code tools so that every change is reviewed, tracked, tested in a non-production environment, and repeatable. This also helps when you run many applications that should share a common baseline, because the shared rules are defined once and applied consistently.
Define a baseline policy
Create a standard set of rules, such as common WAF protections and a default rate limit, that every application starts with.
Layer application-specific rules
Add rules that reflect each application’s needs, such as protecting an admin path or a login endpoint.
Test in a staging environment
Apply changes first to a staging setup with realistic traffic, in preview mode.
Review and promote
Use code review and an approval process before changes reach production.
Audit regularly
Periodically review all rules, remove stale ones, and confirm that descriptions and owners are current.
Think of a hotel chain with a standard security handbook for every property, plus a short local addendum for each building. Everyone knows the baseline, and each location adds what is unique. Policies as code give you the handbook and the addenda in a form that can be reviewed and reused.
If a serverless service or a virtual machine can be reached directly, Cloud Armor on the load balancer is bypassed. Always lock down direct access so the load balancer is the only way in.
11Tiers, Cost, and Trade-offs
Cloud Armor is offered in tiers with different pricing models. Understanding them helps you match protection to risk and budget.
Standard and Enterprise tiers
The standard tier is pay-as-you-go. You are charged for the security policies and rules you create, and for the well-formed requests that are evaluated by those policies. It suits smaller workloads and teams that want to pay only for what they use. The enterprise tier is subscription based, with a predictable monthly price that includes DDoS and WAF services, curated rule sets, access to Adaptive Protection, and attack visibility telemetry. It suits organizations with large or critical applications that value predictable cost and the extra features. Tier names, features, and prices are updated over time, so always confirm on the official pages.
| Aspect | Standard tier | Enterprise tier |
|---|---|---|
| Pricing model | Pay as you go for policies, rules, and evaluated requests | Subscription with predictable monthly price |
| Core WAF and rate limiting | Available | Available |
| Adaptive Protection | Requires an appropriate subscription | Included |
| Attack visibility telemetry | Limited | Included |
| Best for | Smaller or variable workloads | Large, critical, or heavily targeted applications |
What drives cost
Policies and rules
The number of policies and rules you maintain can be a billing factor on the standard model.
Request volume
Well-formed requests evaluated by policies are metered, so heavy traffic raises the cost.
Subscription
Enterprise brings a fixed fee in exchange for predictability and added capabilities.
Logging and monitoring
Verbose logs and long retention add logging cost, so use detailed logging deliberately.
Load balancer and bandwidth
The underlying load balancer and data transfer have their own costs, separate from the security service.
Advantages and trade-offs
Advantages
- Stops attacks at the edge, saving backend capacity
- Preconfigured rules aligned with common industry standards
- Flexible rules for rate limiting, geography, and custom logic
- Bot management and machine-learning defenses available
- Works with hybrid and multi-cloud backends behind a load balancer
- Integrates with logging, monitoring, and central security tools
Disadvantages / Trade-offs
- Only protects traffic flowing through supported load balancers
- Rules need tuning to avoid blocking legitimate users
- Signature-based protection cannot catch every new attack
- Some advanced features need the higher tier
- Rule order and priority mistakes can silently weaken protection
Where Cloud Armor fits among defenses
| Control | Protects against | Where it acts |
|---|---|---|
| Cloud Armor | Web attacks, floods, bots, unwanted sources | Edge, in front of load balancers |
| Virtual private cloud firewall rules | Unwanted network connections to resources | Inside your private network |
| Identity-aware access controls | Unauthorized users reaching an application | Application access layer |
| Secure coding and patching | Vulnerabilities in your own software | Inside the application |
| Data encryption and key controls | Exposure of stored or transmitted data | Storage and transport |
Tier names, included features, and prices are updated by Google Cloud over time. Confirm them on the official pricing and overview pages before finalizing a plan.
12Design Patterns and Anti-patterns
Good patterns make Cloud Armor quiet and effective. Anti-patterns make it either useless or a source of outages.
Patterns worth adopting
Preview, observe, enforce
Every new or changed rule goes in preview mode first. Teams read the logs, confirm that no legitimate traffic would be affected, and only then turn on enforcement.
Layered defense
Combine WAF rules, rate limiting, bot management, geography filters, and Adaptive Protection, so each layer covers weaknesses of the others instead of relying on a single control.
Protect sensitive paths specially
Apply stricter rules and tighter rate limits to login, password reset, checkout, and administrative paths, which attackers target most.
Shared baseline plus local rules
Maintain a standard baseline policy that every application inherits, then add application-specific rules. This keeps coverage consistent across many services.
Close the back doors
Make the load balancer the only path to backends by restricting direct access, so attackers cannot walk around the policy.
Anti-patterns to avoid
Problem
New rules, especially strict WAF rules, are turned on in enforcement mode immediately in production.
Why It’s Harmful
False positives block real customers and partners, causing outages and lost revenue before anyone understands why.
Correct Approach
Deploy in preview mode, examine the logs, tune the rule, and enforce only when you are confident.
Problem
A broad allow rule, such as one for a whole network or a header value, is placed above the security rules.
Why It’s Harmful
Anything matching that allow skips WAF inspection entirely, giving attackers a bypass that is easy to spoof, especially when it relies on a header they can set.
Correct Approach
Place security rules before broad allows, and reserve early allow rules for tightly controlled trusted sources.
Problem
Backends remain reachable directly by their own addresses, while the policy protects only the load balancer.
Why It’s Harmful
Attackers who discover the direct address bypass Cloud Armor completely and hit the unprotected servers.
Correct Approach
Restrict backend access so that only the load balancer can reach it, using network firewall rules or service access settings.
Problem
A single rate limit based only on source address is applied across the whole site with a guessed threshold.
Why It’s Harmful
Legitimate users behind shared addresses are throttled while distributed attackers slip through, and the guessed number is wrong for both.
Correct Approach
Learn real traffic patterns, choose appropriate keys, set thresholds per sensitive endpoint, and test in preview first.
Problem
Rules are numbered one, two, three with no gaps and carry no descriptions or owners.
Why It’s Harmful
Inserting a rule later forces renumbering and mistakes, and nobody remembers why a rule exists, so stale rules accumulate or are deleted blindly.
Correct Approach
Space priorities widely, write descriptions, and keep a record of ownership and rationale.
Problem
The team believes the WAF makes the application safe and stops fixing vulnerabilities.
Why It’s Harmful
Signature rules can be evaded and miss novel attacks, so unpatched flaws remain exploitable, and a single misconfiguration can expose everything.
Correct Approach
Treat the WAF as one layer. Keep patching, writing secure code, and using authentication and least privilege.
13Best Practices and Common Mistakes
A checklist of habits that experienced teams build into every Cloud Armor deployment, and the traps that catch newcomers.
Best practices
Start with the basics enabled
Turn on a baseline of preconfigured WAF rules at a sensible sensitivity, a default rate limit, and logging from day one.
Always use preview first
Test every new rule and every change in preview mode and read the logs before enforcing.
Order rules deliberately
Place explicit denies first, trusted allows carefully, security rules next, broader allows after, and a considered default last.
Space priorities and describe rules
Leave gaps between numbers and write a short description on every rule.
Enable JSON parsing when needed
If your application accepts JSON, enable parsing so the WAF understands the data and produces fewer false positives.
Rate limit sensitive endpoints
Apply sensible thresholds on logins, signups, resets, and expensive operations, based on real traffic.
Turn on Adaptive Protection and alerting
Where available, enable it and make sure the right people are notified of suspected attacks.
Close direct access to backends
Ensure the load balancer is the only route to your services.
Manage policies as code
Keep policies in version control, review changes, test in staging, and audit rules regularly.
Common mistakes
Assuming a higher number runs first. Lower numbers are checked first, so a rule you expected to act may be shadowed by an earlier one.
Keeping detailed logging enabled permanently, generating large log volume, higher cost, and more sensitive data stored than necessary.
Treating region filters as strong protection. Mapping is imperfect and people can appear to be elsewhere, so use it as a coarse filter only.
Disabling a whole rule set because of a few noisy signatures. Tune the specific signatures instead and keep the rest of the protection.
Setting rate limits once and forgetting them while traffic grows. Review thresholds regularly as your application and audience change.
Waiting until an attack to decide who can change rules, which rules to apply, and how to communicate. Write and rehearse a playbook in advance.
A short pre-launch review
| Question | What a good answer looks like |
|---|---|
| Are baseline WAF rules enabled and tuned? | Yes, tested in preview with false positives handled |
| Are sensitive paths rate limited? | Yes, with thresholds based on real traffic |
| Is rule order correct? | Denies, trusted allows, security rules, allows, then default, with spaced priorities |
| Can anyone bypass the load balancer? | No, backends only accept load balancer traffic |
| Will we see attacks and mistakes quickly? | Dashboards and alerts exist for denied traffic and traffic drops |
| Who changes rules during an incident? | Named owners and a rehearsed playbook |
14Real-World and Industry Scenarios
These illustrative scenarios, drawn from common industry patterns, show how the ideas combine in practice.
An online retailer surviving a flash sale and a flood
A retailer expects heavy traffic during a big sale, and attackers try to exploit the moment with a flood of requests to the search and checkout pages. Rate limits on those paths, a baseline of WAF rules, and Adaptive Protection alerts shield the backends, and the team watches dashboards from a prepared playbook. Customers shop normally while the attack is absorbed at the edge.
A bank defending login and account pages
A bank sees waves of credential stuffing against its login page. It applies strict rate limits keyed on the path and on session identifiers, bot management challenges for suspicious visitors, and a region filter for a country it does not serve. Preview mode lets the security team confirm that real customers are not affected before enforcement.
A media company protecting cached content
A media company serves video thumbnails and articles from cache and storage buckets. It uses edge security policies to block abusive regions and known scraper networks before content is served, reducing bandwidth costs and keeping backend servers quiet.
A software-as-a-service provider with many tenants
A provider runs dozens of applications. It keeps a shared baseline policy in version control, with common WAF rules, a default rate limit, and logging, and adds application-specific rules through code review. A central team audits rules quarterly and removes stale ones.
A public sector portal restricted to one country
A government portal serves citizens in one country. It uses a region-based rule as a coarse filter, curated address lists for trusted partner networks, and strong WAF rules for forms. Because geography is approximate, it also relies on authentication and rate limits rather than region filtering alone.
What these scenarios share
Each team combined several layers instead of relying on one control. Each tested rules in preview, tuned for false positives, protected the most sensitive paths specially, closed direct access to backends, and watched logs and dashboards. None treated the firewall as set and forget.
15Frequently Asked Questions
Short, direct answers to questions that come up again and again.
It protects applications reachable through supported load balancers from DDoS and web attacks, bots, and unwanted sources, and extends protection to certain network-level workloads and cached content through related features.
To the backend service of a supported load balancer. Edge security policies attach to cached-content backends such as CDN-enabled services and storage buckets.
In priority order, lowest number first. The first rule that matches decides the outcome. If none matches, the default rule applies.
A setting that lets a rule log what it would have done without enforcing it, so you can test rules against real traffic safely.
Use preview mode, start with a lower WAF sensitivity, enable JSON parsing where needed, tune noisy signatures individually, and monitor logs and traffic drops after enforcement.
Throttling limits a client to a permitted rate and rejects the excess. A rate-based ban blocks a client entirely for a set time after it exceeds a higher threshold.
It can, through integration with a reCAPTCHA product and through rate limiting and custom rules. Bot management is not perfect, so combine it with other controls on sensitive paths.
It learns your normal traffic with machine learning, detects unusual high-volume application-layer attacks, and suggests rules to block them. It is best for volumetric attacks.
Yes, when those services sit behind a supported load balancer through internet or hybrid backend types, so the policy is applied at the edge in front of them.
Use the load balancer logs in Cloud Logging, which record the policy, rule, and outcome for each request, and the monitoring dashboards for aggregate views.
A standard tier charges pay as you go for policies, rules, and evaluated requests. An enterprise tier is subscription based with added features. Confirm current details on the official pricing page.
If backends are reachable directly, yes. Restrict access so only the load balancer can reach them, and layer other controls, because signature-based rules cannot catch everything.
No. It is an important edge layer, but you still need secure code, patching, authentication, least privilege, and network and data protections.
16Summary and Key Takeaways
Cloud Armor is Google Cloud’s managed web application firewall and DDoS defense, enforced at the edge of Google’s network in front of your load balancers. You build security policies from prioritized rules, where lower numbers are checked first and the first match wins, and a default rule catches everything else. Preconfigured WAF rules cover common web attacks and can be tuned by sensitivity and by disabling noisy signatures, while custom expressions handle your own logic. Rate limiting, with throttle and ban actions and a choice of counting keys, stops floods, scraping, and password guessing. Bot management through reCAPTCHA integration separates people from automation, and Adaptive Protection learns your traffic to catch unusual high-volume attacks. Geography filters, address lists, and edge security policies decide who may reach you and protect cached content. Logs, metrics, and preview mode let you test safely and keep watching, and policies are best kept as reviewed code. The standard tier is pay as you go, and the enterprise tier is a subscription with extra features. Success depends on layering defenses, ordering rules carefully, tuning to avoid false positives, closing every back door, and remembering that a firewall complements, and never replaces, secure software.
Key Takeaways
- Defend at the edge — security policies on load balancer backends stop malicious traffic before it consumes your servers.
- Order is everything — lower priority numbers run first, the first match wins, so place denies, trusted allows, security rules, allows, and the default thoughtfully, with spaced priorities.
- Always preview first — test every rule in preview mode, read the logs, tune false positives, and only then enforce.
- Layer your protections — combine preconfigured WAF rules, rate limiting, bot management, Adaptive Protection, and geography or address filters.
- Guard the sensitive paths — apply tighter rate limits and stricter rules to login, reset, checkout, and admin endpoints, with sensible counting keys.
- Close the back doors — make the load balancer the only route to backends, or attackers will bypass the policy entirely.
- Watch, tune, and keep patching — use logs, metrics, and alerts continuously, manage policies as code, and remember that a WAF complements secure code and never replaces it.