The WAF commands provide comprehensive monitoring and troubleshooting capabilities for AWS WAF (Web Application Firewall) to help identify whether blocks are due to WAF rules, application issues, or end-user problems.
waf listList all Web ACLs in your AWS account.
aws-cloud-utilities waf list [OPTIONS]
Options:
--scope [REGIONAL|CLOUDFRONT]: WAF scope (default: REGIONAL)--output-file FILE: Save output to fileExamples:
# List regional Web ACLs
aws-cloud-utilities waf list
# List CloudFront Web ACLs
aws-cloud-utilities waf list --scope CLOUDFRONT
# Save output to file
aws-cloud-utilities waf list --output-file web-acls.json
waf statsGet comprehensive WAF statistics for troubleshooting.
aws-cloud-utilities waf stats --web-acl WEB_ACL_NAME [OPTIONS]
Options:
--web-acl TEXT: Web ACL name to analyze (required)--hours INTEGER: Hours of data to analyze (default: 24)--scope [REGIONAL|CLOUDFRONT]: WAF scope (default: REGIONAL)--output-file FILE: Save output to fileExamples:
# Get 24-hour stats for a Web ACL
aws-cloud-utilities waf stats --web-acl my-web-acl
# Get 7-day stats
aws-cloud-utilities waf stats --web-acl my-web-acl --hours 168
# Save stats to file
aws-cloud-utilities waf stats --web-acl my-web-acl --output-file waf-stats.json
Output includes:
waf troubleshootGenerate comprehensive WAF troubleshooting report.
aws-cloud-utilities waf troubleshoot --web-acl WEB_ACL_NAME [OPTIONS]
Options:
--web-acl TEXT: Web ACL name to troubleshoot (required)--hours INTEGER: Hours of data to analyze (default: 24)--output-file FILE: Save troubleshooting report to fileExamples:
# Generate troubleshooting report
aws-cloud-utilities waf troubleshoot --web-acl my-web-acl
# Analyze last 48 hours
aws-cloud-utilities waf troubleshoot --web-acl my-web-acl --hours 48
# Save report to file
aws-cloud-utilities waf troubleshoot --web-acl my-web-acl --output-file troubleshoot-report.json
Report includes:
When the troubleshoot command detects a very high block rate:
Possible Causes:
Recommended Actions:
When no requests are detected:
Possible Causes:
Recommended Actions:
When sudden increases in blocked requests are detected:
Possible Causes:
Recommended Actions:
The WAF commands work with:
All commands support multiple output formats:
--output json: JSON format--output yaml: YAML format--output table: Human-readable table (default)aws-cloud-utilities waf stats --web-acl production-waf --hours 24
aws-cloud-utilities waf troubleshoot --web-acl production-waf --hours 2 --output-file incident-report.json
aws-cloud-utilities waf stats --web-acl production-waf --hours 168 --output-file weekly-stats.json
The WAF commands include comprehensive error handling for:
Common errors and solutions: