PlatformWebAcl
WAFv2 web ACL with the AWS managed baseline.
Defaults
AWSManagedRulesCommonRuleSet,AWSManagedRulesKnownBadInputsRuleSet,AWSManagedRulesAmazonIpReputationList(each can be disabled)- Rate limit rule: 2000 requests per 5 minutes per IP (
rateLimit, orfalse) - CloudWatch metrics and sampled requests on, default action allow
- Scope
REGIONAL;PlatformWebAcl.forDistribution()creates aCLOUDFRONTACL and throws unless the stack targets us-east-1
Where it can be attached
PlatformRestApistages:acl.associate(api.deploymentStage)or thewebAclpropPlatformDistribution: passwebAclId: acl.webAclArnfrom a us-east-1 stack- Not HTTP APIs: WAFv2 does not support API Gateway HTTP APIs (
PlatformHttpApi). Put aPlatformDistributionin front if WAF is required.
Alarms
alarms.blockedRequests() (> 100 per 5 minutes).
Example
ts
const firewall = new PlatformWebAcl(this, "Firewall", { rateLimit: 1000 });
const admin = new PlatformRestApi(this, "Admin", { webAcl: firewall });
firewall.alarms.blockedRequests();