Subchapter 96.6
references/protecting-against-bots-with-bot-control.mdMarkdown10 KBView on GitHub
Domain expertise for the AWS WAF Bot Control on-ramp: adding the Bot Control managed rule group, choosing Common versus Targeted, and observing in Count mode before enforcing. Covers the sharp difference between Common and Targeted, the application integration SDK as a precondition for Targeted, the machine learning warm-up, the verified-bot Count-override gotcha, and the added cost.
Does not cover what to do with the labels Bot Control produces; turning labels into a confidence signal, forwarding that signal, and the application’s response are three separate references that build on this one.
Execute commands using the AWS MCP server when connected (sandboxed execution, audit logging, observability). Fall back to the AWS CLI otherwise.
To turn on Bot Control end to end, follow the procedure exactly. See the Procedure section below.
The procedure covers:
This reference is the on-ramp. Turning the labels into an application decision is the turning-bot-control-labels-into-a-confidence-signal reference and the ones after it.
| Level | Detects | SDK | Best for |
|---|---|---|---|
| Common | Self-identifying bots (user-agent such as curl, python-requests, declared crawlers) and known-bad IPs | Not required | Basic filtering of honest bots |
| Targeted | Adds behavioral machine learning, browser interrogation, and token session tracking | Strongly required | Login, checkout, any high-value endpoint facing evasive bots |
Constraints:
Targeted’s behavioral machine learning, browser interrogation, and token session tracking are largely blind without the application integration SDK or its JavaScript token.
Constraints:
The TGT_ML_* rules need up to roughly 24 hours to establish a traffic baseline. Customers enable
Targeted, see nothing fire immediately, and assume it is broken.
Constraints:
TGT_ML_* rules need up to roughly 24 hours of warm-up before
they actBot Control does not block verified bots; it labels them. Overriding the whole rule group to Count while tuning also overrides the implicit Allow for verified bots, so they fall through to the customer’s other rules.
Constraints:
awswaf:managed:aws:bot-control:bot:verified label
when tuning the group in Count, so verified bots keep passingBot Control incurs additional fees beyond the basic AWS WAF charges.
Constraints:
Common only catches self-identifying bots and known-bad IPs. Move to Targeted with the SDK (Decision: Common vs Targeted).
The TGT_ML_* rules are still warming up. Wait up to roughly 24 hours (Machine learning warm-up).
Overriding the whole group to Count canceled the verified-bot Allow. Add an explicit Allow on the verified label (Verified-bot Count-override gotcha).
This procedure adds Bot Control at the chosen level in Count mode, keeps verified bots passing, then enforces, and surfaces the console link.
COMMON or TARGETED.Constraints for parameter acquisition:
Constraints:
aws sts get-caller-identityConstraints:
You MUST add the Bot Control rule group at the chosen inspection level with the group in Count while observing
You MUST add an explicit Allow rule on awswaf:managed:aws:bot-control:bot:verified so verified
bots keep passing during tuning
You MUST fetch the current LockToken before update-web-acl and pass the full rule set
You MUST preserve the web ACL’s existing DefaultAction from the get-web-acl response and pass
it back as {default_action}; do not assume Allow={}, since that would silently open all
unmatched traffic on a web ACL whose default action is Block. For example, the Bot Control group
at the chosen inspection level plus the verified-bot Allow rule:
aws wafv2 get-web-acl --name {web_acl_name} --scope {scope} --id {web_acl_id} --region {region}
aws wafv2 update-web-acl --name {web_acl_name} --scope {scope} --id {web_acl_id} \
--lock-token {lock_token} --default-action {default_action} \
--rules '[{"Name":"AWS-BotControl","Priority":1,"Statement":{"ManagedRuleGroupStatement":{"VendorName":"AWS","Name":"AWSManagedRulesBotControlRuleSet","ManagedRuleGroupConfigs":[{"AWSManagedRulesBotControlRuleSet":{"InspectionLevel":"{inspection_level}"}}]}},"OverrideAction":{"Count":{}},"VisibilityConfig":{"SampledRequestsEnabled":true,"CloudWatchMetricsEnabled":true,"MetricName":"AWS-BotControl"}},{"Name":"AllowVerifiedBots","Priority":2,"Action":{"Allow":{}},"Statement":{"LabelMatchStatement":{"Scope":"LABEL","Key":"awswaf:managed:aws:bot-control:bot:verified"}},"VisibilityConfig":{"SampledRequestsEnabled":true,"CloudWatchMetricsEnabled":true,"MetricName":"AllowVerifiedBots"}}]' \
--visibility-config SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName={web_acl_name} \
--region {region}Constraints:
Constraints:
You MUST present the web ACL console link and tell the customer to open the Bot Control rule and confirm its level and actions:
https://us-east-1.console.aws.amazon.com/wafv2/homev2/web-acls?region={region}{
"web_acl_name": "example-webacl",
"web_acl_id": "abc",
"scope": "REGIONAL",
"inspection_level": "TARGETED"
}Confirmed the SDK is integrated. Added Bot Control TARGETED in Count, with an explicit Allow on the verified-bot label.
TGT_ML rules need up to ~24h to warm up before acting.
Open the web ACL and confirm the Bot Control level and actions:
https://us-east-1.console.aws.amazon.com/wafv2/homev2/web-acls?region=us-east-1Move to Targeted with the SDK (Step 1).
The machine learning is warming up; wait up to roughly 24 hours (Step 3).
Add the explicit Allow on the verified label (Step 2).
This procedure modifies a security control, so misconfiguration directly weakens the application’s defenses.
wafv2: actions a task needs (for example wafv2:GetWebACL and wafv2:UpdateWebACL) rather than wafv2:* or the AWSWAFFullAccess managed policy.aws sts assume-role) rather than long-lived IAM user access keys when running these WAF CLI commands.wafv2 management events and set CloudWatch alarms on critical web ACL configuration changes (such as DeleteWebACL and UpdateWebACL rule removals) and on the web ACL’s BlockedRequests and CountedRequests metrics, so rule changes and sudden spikes in blocked or counted traffic are detected.