Creates and manages web ACLs with IP sets and rate-based rules, associates them with Application Load Balancers, API Gateway stages, and CloudFront distributions, and inspects sampled requests.
Agentic Workflow: Read -> Reason -> Act (aws-waf)
You are Aws Waf (api/general) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — api context for aws-waf
- Domain: Creates and manages web ACLs with IP sets and rate-based rules, associates them with Application Load Balancers, API Gateway stages, and CloudFront distributions, and inspects sampled requests.
- web-acl: Create and inspect WAF web ACLs. —
aws wafv2 list-web-acls --scope REGIONAL
- rules-ipset: Add rules and IP sets to web ACLs. —
aws wafv2 create-ip-set --name blocked-ips --scope REGIONAL --ip-address-version
- associate: Associate web ACLs with protected resources. —
aws wafv2 associate-web-acl --web-acl-arn arn:aws:wafv2:us-east-1:111122223333:r
- Check
knowledge and prerequisites: aws
2. Reason — think for aws-waf
- For
web-acl: Create and inspect WAF web ACLs. — decide which checks to run
- For
rules-ipset: Add rules and IP sets to web ACLs. — decide which checks to run
- For
associate: Associate web ACLs with protected resources. — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with aws-waf tools
- Tools:
Glob, Grep, Read, Aws (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
aws-waf:bd13f7c0
AWS WAF
What this skill does
Manages AWS WAF web ACLs: creating ACLs and rule groups, blocking IP sets, rate-based rules, associating with ALB/API Gateway/CloudFront, and inspecting sampled requests.
When to use
- Blocking abusive IPs or bot traffic
- Rate-limiting an API at the edge
- Meeting compliance with managed rules (OWASP CRS)
Real commands
# Create a web ACL
aws wafv2 create-web-acl --name my-acl --scope REGIONAL --default-action Allow={} --visibility-config SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=my-acl
# Create and update an IP set
aws wafv2 create-ip-set --name blocked-ips --scope REGIONAL --ip-address-version IPV4 --addresses 203.0.113.0/24
aws wafv2 update-ip-set --name blocked-ips --scope REGIONAL --id acl123 --addresses 203.0.113.0/24 198.51.100.0/24 --lock-token TOKEN123
# Attach rules from a JSON file
aws wafv2 update-web-acl --name my-acl --scope REGIONAL --id acl123 --default-action Allow={} --visibility-config SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=my-acl --rules file://rules.json
# Associate with an ALB
aws wafv2 associate-web-acl --web-acl-arn arn:aws:wafv2:us-east-1:111122223333:regional/webacl/my-acl/acl123 --resource-arn <alb-arn>
# See blocked IPs under a rate rule
aws wafv2 get-rate-based-statement-managed-keys --scope REGIONAL --web-acl-name my-acl --web-acl-id acl123
Rules JSON fragment
{"Name": "block-abuse", "Priority": 1, "Statement": {"IPSetReferenceStatement": {"ARN": "arn:aws:wafv2:...:ipset/blocked-ips/acl123"}}, "Action": {"Block": {}}, "VisibilityConfig": {"SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "block-abuse"}}
Testing
- Curl the endpoint from an IP in the blocked set and expect 403
- Use sampled requests via CloudWatch Logs to verify decisions
Best practices
- Start in Count mode, review logs, then switch to Block
- Use managed rule groups (AWSManagedRulesCommonRuleSet) first
- Scope ACLs to specific resources, not everything
Capabilities
web-acl
Create and inspect WAF web ACLs.
Parameters:
scope (string): REGIONAL or CLOUDFRONT
acl_name (string): Web ACL name
Commands:
aws wafv2 list-web-acls --scope REGIONAL
aws wafv2 create-web-acl --name my-acl --scope REGIONAL --default-action Allow={} --visibility-config SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=my-acl
aws wafv2 get-web-acl --name my-acl --scope REGIONAL --id acl123
aws wafv2 delete-web-acl --name my-acl --scope REGIONAL --id acl123 --lock-token TOKEN123
aws wafv2 list-web-acls --scope CLOUDFRONT
Examples:
- aws wafv2 list-web-acls --scope REGIONAL --query 'WebACLs[].{name:Name,id:Id}'
- aws wafv2 create-web-acl --name my-acl --scope REGIONAL --default-action Allow={} --visibility-config SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=my-acl --rules file://rules.json
- aws wafv2 get-web-acl --name my-acl --scope REGIONAL --id acl123 | jq '.WebACL.Rules[].Name'
rules-ipset
Add rules and IP sets to web ACLs.
Parameters:
ip_set_name (string): IP set name
addresses (string): CIDR addresses
rules_file (string): JSON rules file
Commands:
aws wafv2 create-ip-set --name blocked-ips --scope REGIONAL --ip-address-version IPV4 --addresses 203.0.113.0/24
aws wafv2 get-ip-set --name blocked-ips --scope REGIONAL --id ipset123
aws wafv2 update-web-acl --name my-acl --scope REGIONAL --id acl123 --default-action Allow={} --visibility-config SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=my-acl --rules file://rules.json
aws wafv2 list-ip-sets --scope REGIONAL
aws wafv2 get-rate-based-statement-managed-keys --scope REGIONAL --web-acl-name my-acl --web-acl-id acl123
Examples:
- aws wafv2 create-ip-set --name blocked-ips --scope REGIONAL --ip-address-version IPV4 --addresses 203.0.113.0/24 198.51.100.0/24
- aws wafv2 update-ip-set --name blocked-ips --scope REGIONAL --id acl123 --addresses 203.0.113.0/24 --lock-token TOKEN123
- aws wafv2 get-rate-based-statement-managed-keys --scope REGIONAL --web-acl-name my-acl --web-acl-id acl123 | jq '.ManagedKeysIPV4'
associate
Associate web ACLs with protected resources.
Parameters:
resource_arn (string): ARN of the protected resource
web_acl_arn (string): Web ACL ARN
Commands:
aws wafv2 associate-web-acl --web-acl-arn arn:aws:wafv2:us-east-1:111122223333:regional/webacl/my-acl/acl123 --resource-arn arn:aws:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/api/abc
aws wafv2 disassociate-web-acl --resource-arn arn:aws:apigateway:us-east-1::/restapis/abc123xyz/stages/prod
aws wafv2 get-web-acl-for-resource --resource-arn arn:aws:apigateway:us-east-1::/restapis/abc123xyz/stages/prod
aws wafv2 list-resources-for-web-acl --web-acl-arn arn:aws:wafv2:us-east-1:111122223333:regional/webacl/my-acl/acl123
Examples:
- aws wafv2 associate-web-acl --web-acl-arn arn:aws:wafv2:us-east-1:111122223333:regional/webacl/my-acl/acl123 --resource-arn arn:aws:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/api/abc
- aws wafv2 get-web-acl-for-resource --resource-arn arn:aws:apigateway:us-east-1::/restapis/abc123xyz/stages/prod
- aws wafv2 list-resources-for-web-acl --web-acl-arn arn:aws:wafv2:us-east-1:111122223333:regional/webacl/my-acl/acl123
References
1---2name: "aws-waf"3description: "Creates and manages web ACLs with IP sets and rate-based rules, associates them with Application Load Balancers, API Gateway stages, and CloudFront distributions, and inspects sampled requests. Use when working with web acl, rules ipset, associate, api or when the user mentions web acl, rules ipset, associate, api."4license: "MIT"5compatibility: "Requires aws."6metadata:7 source: https://skillmd.com/skills/opknock/aws-waf8 author: Kdesk9 version: 2.0.010 category: api11allowed-tools: "Glob Grep Read Bash(aws:*)"12---1314Creates and manages web ACLs with IP sets and rate-based rules, associates them with Application Load Balancers, API Gateway stages, and CloudFront distributions, and inspects sampled requests.1516## Agentic Workflow: Read -> Reason -> Act (aws-waf)1718You are **Aws Waf** (api/general) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — api context for `aws-waf`21- Domain: Creates and manages web ACLs with IP sets and rate-based rules, associates them with Application Load Balancers, API Gateway stages, and CloudFront distributions, and inspects sampled requests.22- **web-acl**: Create and inspect WAF web ACLs. — `aws wafv2 list-web-acls --scope REGIONAL`23- **rules-ipset**: Add rules and IP sets to web ACLs. — `aws wafv2 create-ip-set --name blocked-ips --scope REGIONAL --ip-address-version`24- **associate**: Associate web ACLs with protected resources. — `aws wafv2 associate-web-acl --web-acl-arn arn:aws:wafv2:us-east-1:111122223333:r`25- Check `knowledge` and `prerequisites: aws`2627### 2. Reason — think for `aws-waf`28- For `web-acl`: Create and inspect WAF web ACLs. — decide which checks to run29- For `rules-ipset`: Add rules and IP sets to web ACLs. — decide which checks to run30- For `associate`: Associate web ACLs with protected resources. — decide which checks to run31- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3233### 3. Act — execute with `aws-waf` tools34- Tools: `Glob`, `Grep`, `Read`, `Aws` (see frontmatter `tools`/`allowed-tools`)35- Use `safe_path` for any write; record evidence (paths, checksums)36- Fingerprint: `aws-waf:bd13f7c0`3738# AWS WAF3940## What this skill does4142Manages AWS WAF web ACLs: creating ACLs and rule groups, blocking IP sets, rate-based rules, associating with ALB/API Gateway/CloudFront, and inspecting sampled requests.4344## When to use4546- Blocking abusive IPs or bot traffic47- Rate-limiting an API at the edge48- Meeting compliance with managed rules (OWASP CRS)4950## Real commands5152```bash53# Create a web ACL54aws wafv2 create-web-acl --name my-acl --scope REGIONAL --default-action Allow={} --visibility-config SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=my-acl5556# Create and update an IP set57aws wafv2 create-ip-set --name blocked-ips --scope REGIONAL --ip-address-version IPV4 --addresses 203.0.113.0/2458aws wafv2 update-ip-set --name blocked-ips --scope REGIONAL --id acl123 --addresses 203.0.113.0/24 198.51.100.0/24 --lock-token TOKEN1235960# Attach rules from a JSON file61aws wafv2 update-web-acl --name my-acl --scope REGIONAL --id acl123 --default-action Allow={} --visibility-config SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=my-acl --rules file://rules.json6263# Associate with an ALB64aws wafv2 associate-web-acl --web-acl-arn arn:aws:wafv2:us-east-1:111122223333:regional/webacl/my-acl/acl123 --resource-arn <alb-arn>6566# See blocked IPs under a rate rule67aws wafv2 get-rate-based-statement-managed-keys --scope REGIONAL --web-acl-name my-acl --web-acl-id acl12368```6970## Rules JSON fragment7172```json73{"Name": "block-abuse", "Priority": 1, "Statement": {"IPSetReferenceStatement": {"ARN": "arn:aws:wafv2:...:ipset/blocked-ips/acl123"}}, "Action": {"Block": {}}, "VisibilityConfig": {"SampledRequestsEnabled": true, "CloudWatchMetricsEnabled": true, "MetricName": "block-abuse"}}74```7576## Testing7778- Curl the endpoint from an IP in the blocked set and expect 40379- Use sampled requests via CloudWatch Logs to verify decisions8081## Best practices8283- Start in Count mode, review logs, then switch to Block84- Use managed rule groups (AWSManagedRulesCommonRuleSet) first85- Scope ACLs to specific resources, not everything8687## Capabilities8889### web-acl90Create and inspect WAF web ACLs.9192**Parameters:**93- `scope` (string): REGIONAL or CLOUDFRONT94- `acl_name` (string): Web ACL name9596**Commands:**97- `aws wafv2 list-web-acls --scope REGIONAL`98- `aws wafv2 create-web-acl --name my-acl --scope REGIONAL --default-action Allow={} --visibility-config SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=my-acl`99- `aws wafv2 get-web-acl --name my-acl --scope REGIONAL --id acl123`100- `aws wafv2 delete-web-acl --name my-acl --scope REGIONAL --id acl123 --lock-token TOKEN123`101- `aws wafv2 list-web-acls --scope CLOUDFRONT`102103**Examples:**104- aws wafv2 list-web-acls --scope REGIONAL --query 'WebACLs[].{name:Name,id:Id}'105- aws wafv2 create-web-acl --name my-acl --scope REGIONAL --default-action Allow={} --visibility-config SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=my-acl --rules file://rules.json106- aws wafv2 get-web-acl --name my-acl --scope REGIONAL --id acl123 | jq '.WebACL.Rules[].Name'107108### rules-ipset109Add rules and IP sets to web ACLs.110111**Parameters:**112- `ip_set_name` (string): IP set name113- `addresses` (string): CIDR addresses114- `rules_file` (string): JSON rules file115116**Commands:**117- `aws wafv2 create-ip-set --name blocked-ips --scope REGIONAL --ip-address-version IPV4 --addresses 203.0.113.0/24`118- `aws wafv2 get-ip-set --name blocked-ips --scope REGIONAL --id ipset123`119- `aws wafv2 update-web-acl --name my-acl --scope REGIONAL --id acl123 --default-action Allow={} --visibility-config SampledRequestsEnabled=true,CloudWatchMetricsEnabled=true,MetricName=my-acl --rules file://rules.json`120- `aws wafv2 list-ip-sets --scope REGIONAL`121- `aws wafv2 get-rate-based-statement-managed-keys --scope REGIONAL --web-acl-name my-acl --web-acl-id acl123`122123**Examples:**124- aws wafv2 create-ip-set --name blocked-ips --scope REGIONAL --ip-address-version IPV4 --addresses 203.0.113.0/24 198.51.100.0/24125- aws wafv2 update-ip-set --name blocked-ips --scope REGIONAL --id acl123 --addresses 203.0.113.0/24 --lock-token TOKEN123126- aws wafv2 get-rate-based-statement-managed-keys --scope REGIONAL --web-acl-name my-acl --web-acl-id acl123 | jq '.ManagedKeysIPV4'127128### associate129Associate web ACLs with protected resources.130131**Parameters:**132- `resource_arn` (string): ARN of the protected resource133- `web_acl_arn` (string): Web ACL ARN134135**Commands:**136- `aws wafv2 associate-web-acl --web-acl-arn arn:aws:wafv2:us-east-1:111122223333:regional/webacl/my-acl/acl123 --resource-arn arn:aws:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/api/abc`137- `aws wafv2 disassociate-web-acl --resource-arn arn:aws:apigateway:us-east-1::/restapis/abc123xyz/stages/prod`138- `aws wafv2 get-web-acl-for-resource --resource-arn arn:aws:apigateway:us-east-1::/restapis/abc123xyz/stages/prod`139- `aws wafv2 list-resources-for-web-acl --web-acl-arn arn:aws:wafv2:us-east-1:111122223333:regional/webacl/my-acl/acl123`140141**Examples:**142- aws wafv2 associate-web-acl --web-acl-arn arn:aws:wafv2:us-east-1:111122223333:regional/webacl/my-acl/acl123 --resource-arn arn:aws:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/api/abc143- aws wafv2 get-web-acl-for-resource --resource-arn arn:aws:apigateway:us-east-1::/restapis/abc123xyz/stages/prod144- aws wafv2 list-resources-for-web-acl --web-acl-arn arn:aws:wafv2:us-east-1:111122223333:regional/webacl/my-acl/acl123145146## References147- [WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/)148- [AWS CLI wafv2 Reference](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/wafv2/index.html)