Skip to main content
skill CX Codex

waf — Claude Code skill: configure AWS WAF

A skill for configuring AWS WAF: web ACLs, managed rules, Bot Control, login and signup protection. Useful when you need to defend an app or API at layer 7.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add aws/agent-toolkit-for-aws --skill waf -a claude-code
Open on GitHub

What waf does

This skill covers AWS WAF setup — filtering HTTP and HTTPS traffic for CloudFront, Application Load Balancers, API Gateway and AppSync. It is a router, not a single document: each task points to its own file under references/, and the agent reads the matching one in full before acting. Those files carry their own decision tables, constraints and steps.

What you can hand off: creating a web ACL and associating it with a resource, logging and request sampling, AWS Managed Rules tuned in Count mode, rate-based rules against HTTP floods, IP set and geographic match rules, Bot Control (Common and Targeted), Fraud Control for logins and signups, and AI crawler traffic. Commands run through the AWS MCP server when it is connected, otherwise through the AWS CLI.

One constraint is worth knowing up front: a web ACL's scope is fixed at creation. CloudFront needs us-east-1 with CLOUDFRONT scope, regional resources need REGIONAL in their own Region. You cannot change it later, so the ACL comes first. Turn on logging before tuning anything — Count mode has nothing to read without it. The skill does not handle L3/L4 DDoS, multi-account rollout, or CloudFront and Route 53 configuration; those live in separate skills.

What it helps with

  • create a web ACL and attach it to CloudFront or an ALB
  • turn on logging and request sampling before tuning rules
  • add AWS Managed Rules and cut false positives with Count mode
  • throttle HTTP floods and brute force attempts
  • protect logins and signups from credential stuffing and fake accounts

Example prompts for the agent

  • Create a web ACL for my CloudFront distribution and associate it
  • Set up logging and request sampling for this web ACL
  • Configure Bot Control in Targeted mode for the login endpoint

How to install waf

1Skills CLI (Vercel)

npx skills add aws/agent-toolkit-for-aws --skill waf -a claude-code

2Manually: put the files in place

~/.claude/skills/waf/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/waf/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about waf

How do I install waf in Claude?

Run npx skills add aws/agent-toolkit-for-aws --skill waf -a claude-code. The skill lands in ~/.claude/skills/waf/SKILL.md.

What does the waf skill do?

It walks the agent through AWS WAF configuration: creating web ACLs, adding managed rules, rate-based rules, Bot Control and Fraud Control. Each task maps to a separate file under references/.

How is Fraud Control different from rate-based rules?

Rate-based rules blunt volumetric HTTP floods. Credential stuffing and fake-account creation are account-level abuse that rate limiting misses, so those go to the Fraud Control reference instead.

Source text

SKILL.md · Apache-2.0
---
name: waf
description: >-
  Configures AWS WAF to filter web traffic: creating web access control lists (web ACLs) on
  CloudFront, Application Load Balancers, API Gateway, and AppSync; AWS Managed Rules tuned in Count
  mode; rate-based rules for HTTP floods; IP set and geographic match rules; Bot Control (Common and
  Targeted); turning bot labels into a confidence signal; stripping spoofed inbound x-amzn-waf-*
  headers; recovering the real client IP behind a CDN; Fraud Control (account takeover and account
  creation fraud prevention); and logging and request sampling. Use when the user wants to protect a
  web application or API from common exploits, bots, credential stuffing, fake-account creation, or
  HTTP floods at the application layer (layer 7). Routes to the right per-task procedure in
  references. Do NOT use for L3/L4 DDoS protection (shieldadvanced skill), multi-account WAF rollout
  (firewallmanager skill), CloudFront configuration (cloudfront skill), or Route 53 health checks or
  records (route53 skill).
version: 1
---

# AWS WAF

## Overview

Domain expertise for configuring AWS WAF, the web application firewall that filters HTTP and HTTPS
traffic to CloudFront distributions, Application Load Balancers, API Gateway REST APIs, and AppSync
GraphQL APIs. Covers web ACL creation and association, AWS Managed Rules, rate-based rules, match
rules (IP set and geographic), Bot Control and the signal-forwarding workflows built on top of it,
Fraud Control for logins and signups, AI and LLM crawler management, and the logging that every
tuning workflow depends on.

This skill is a router. Each customer task maps to a procedure file under `references/`. Read the
matching reference in full before acting, then follow its constraints and steps. The reference
files are self-contained: each carries its own decision tables, constraints, procedure, and
troubleshooting.

Execute commands using the AWS MCP server when connected (sandboxed execution, audit logging,
observability). Fall back to the AWS CLI otherwise. A web ACL's scope is fixed at creation: a
CloudFront web ACL must be created in `us-east-1` with `CLOUDFRONT` scope, while a regional web ACL
(Application Load Balancer, API Gateway, AppSync) is created in the resource's Region with
`REGIONAL` scope.

## Which WAF task do you need?

| Goal | Reference |
| --- | --- |
| Create a web ACL and attach it to a resource | [creating a web ACL and associating it with a resource](references/creating-a-web-acl-and-associating-it-with-a-resource.md) |
| Set up logging and sampling before tuning anything | [setting up logging and request sampling](references/setting-up-logging-and-request-sampling.md) |
| Add AWS Managed Rules and tune false positives | [adding managed rules and tuning with count mode](references/adding-managed-rules-and-tuning-with-count-mode.md) |
| Throttle HTTP floods and brute force | [adding rate-based rules](references/adding-rate-based-rules.md) |
| Allow or block by IP range or country | [using ip sets and geographic match rules](references/using-ip-sets-and-geographic-match-rules.md) |
| Detect and control bots (the on-ramp) | [protecting against bots with bot control](references/protecting-against-bots-with-bot-control.md) |
| Collapse bot labels into one confidence signal | [turning bot control labels into a confidence signal](references/turning-bot-control-labels-into-a-confidence-signal.md) |
| Forward all signals to the origin with one rule | [forwarding signals with dynamic label interpolation](references/forwarding-signals-with-dynamic-label-interpolation.md) |
| Decide what the app does with the forwarded signal | [adaptive mitigation playbook for forwarded signals](references/adaptive-mitigation-playbook-for-forwarded-signals.md) |
| Stop attackers from spoofing forwarded headers | [stripping inbound waf headers before trusting them](references/stripping-inbound-waf-headers-before-trusting-them.md) |
| Recover the real client IP behind a CDN | [recovering the real client ip behind a cdn](references/recovering-the-real-client-ip-behind-a-cdn.md) |
| Protect logins and signups from fraud | [protecting logins and signups with fraud control](references/protecting-logins-and-signups-with-fraud-control.md) |
| See and manage AI and LLM crawler traffic | [seeing and managing ai crawler traffic](references/seeing-and-managing-ai-crawler-traffic.md) |

## Routing notes

- **Logging comes before tuning.** Every Count-mode tuning workflow assumes logging and request
  sampling are on. If the customer has not set up logging, run that reference first; otherwise
  Count-mode tuning has nothing to read.
- **Web ACL scope is fixed at creation.** A CloudFront web ACL is `CLOUDFRONT` scope in
  `us-east-1`; a regional resource needs a `REGIONAL` web ACL in its own Region. Scope cannot be
  changed later, so the creating reference settles it before anything is built.
- **Bot Control is a chain, not one task.** Protecting against bots is the on-ramp (turn on, choose
  Common vs Targeted, observe). Turning labels into a confidence signal, forwarding that signal,
  and deciding what the application does with it are three separate references that build on it in
  that order. The header-stripping reference is the mandatory safety companion whenever a signal is
  forwarded to the origin.
- **Common vs Targeted is not a soft choice.** Common only catches self-identifying bots and
  known-bad IPs. For login, checkout, or any high-value endpoint facing evasive bots, Targeted with
  the application integration SDK is required. The bots reference pushes Targeted for real bot
  threats rather than presenting it as optional.
- **Rate limiting vs Fraud Control.** Rate-based rules blunt volumetric HTTP floods. Credential
  stuffing and fake-account creation are account-based abuse that rate limiting misses; those go to
  the Fraud Control reference (ATP and ACFP), not the rate-based reference.
- **Forwarded headers need the strip rule.** Any time the customer forwards a signal or the client
  IP to the origin in `x-amzn-waf-*` headers, the inbound-header-stripping reference is required to
  prevent spoofing. The confidence-signal, interpolation, and client-IP references all point at it.
- **What lives in other skills.** L3/L4 DDoS protection and Shield cost-protection credits are the
  shieldadvanced skill. Multi-account WAF rollout is the firewallmanager skill. CloudFront and
  Application Load Balancer configuration are their own skills. This skill builds the WAF rules; it
  does not configure the resources it protects.

## Security Considerations

AWS WAF is itself a security control, so misconfiguration directly weakens an application's defenses.
Apply these across every reference:

- **Least-privilege IAM.** You MUST grant only the specific `wafv2:` actions a task needs (for
  example `wafv2:CreateWebACL`, `wafv2:GetWebACL`, `wafv2:UpdateWebACL`, `wafv2:AssociateWebACL`,
  `wafv2:PutLoggingConfiguration`) rather than `wafv2:*` or the `AWSWAFFullAccess` managed policy.
- **Ephemeral credentials.** You MUST use IAM roles with temporary credentials (such as an EC2
  instance profile, SSO session, or `aws sts assume-role`) rather than long-lived IAM user access
  keys when running these WAF CLI commands.
- **Monitor configuration changes.** You SHOULD enable AWS CloudTrail on `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.
- **Misconfiguration opens access.** A web ACL that is created but never associated, or one whose
  default action is left at `Allow` with no enforcing rules, filters nothing. You MUST confirm the
  web ACL is associated and that its posture matches the intended default (block vs allow) before
  reporting setup complete.
- **Protect log destinations.** Logs can capture credentials and session data. You MUST redact
  sensitive fields (such as the `authorization` header and `cookie`) and MUST enable encryption at
  rest on the log destination (CloudWatch Logs, Amazon S3, or Amazon Data Firehose).
- **Header-spoofing risk.** Any `x-amzn-waf-*` signal forwarded to the origin can be forged inbound.
  You MUST add the inbound-header-stripping rule whenever a signal or client IP is forwarded (see
  stripping-inbound-waf-headers-before-trusting-them).

## Additional Resources

- [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html)
- [How AWS WAF works (AWS WAF Developer Guide)](https://docs.aws.amazon.com/waf/latest/developerguide/how-aws-waf-works.html)
- [AWS WAF pricing](https://aws.amazon.com/waf/pricing/)

© aws · Apache-2.0 · aws/agent-toolkit-for-aws

Similar skills

Everything for Security →

From the same set133

rds-oracle Troubleshoots Amazon RDS for Oracle connectivity, authentication, networking and driver failures. Use it for EC2, EKS, Lambda or Oracle client connection issues. CX Codex +1 4,600installs sitetositevpn A skill that walks the agent through AWS Site-to-Site VPN setup: gateway choice, routing, tunnel bandwidth and down-tunnel diagnosis. CX Codex +1 4,600installs aws-auth Adds Amazon Cognito authentication to web and mobile apps. Use it for sign-in flows, MFA, OAuth federation, token handling, and protected API routes. CX Codex +1 4,500installs timestream-influxdb Advisory skill for planning, provisioning, and securing Amazon Timestream for InfluxDB across V2 and V3 engines using standard AWS CLI commands. CX Codex +1 4,300installs route53 A skill that points your coding agent at the right Amazon Route 53 procedure and walks it through the steps. Handy for records, traffic splitting or blocking bad domains. CX Codex +1 4,300installs aws-security Assesses AWS security architectures, network firewall policies, and findings from services like GuardDuty. Operates strictly read-only via AWS CLI or AWS MCP. CX Codex +1 4,300installs directconnect Configures AWS Direct Connect connections, virtual interfaces, BGP, encryption, and resiliency. Use it when linking a data center or colocation environment to AWS over a private connection. CX Codex +1 4,000installs aws-resilience-lifecycle Walks the agent through Define → Test → Operate on AWS, from Resilience Hub v2 policy to FIS experiments and ARC controls. CX Codex +1 4,100installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor