Description
To inspect requests to an internet-facing ALB with AWS WAF, associate a REGIONAL web ACL in the same Region.
Potential impact
Without the required blocking or rate rules, the application may need to handle unwanted traffic.
Remediation
Set the ALB and web ACL ARNs on AWS::WAFv2::WebACLAssociation. Configure rules and exceptions for the service, then verify which requests are allowed and blocked.
Examples
In the second excerpt, MyWebACLAssociation connects MyLoadBalancer9 to MyWebACL. Supply the subnets and web ACL separately. To protect an existing ALB, reference its existing logical ID.
Before
yaml
AWSTemplateFormatVersion: '2010-09-09'
Resources:
MyLoadBalancer22:
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
Properties:
Type: application
Subnets: !Ref Subnets
Scheme: internet-facing
After
yaml
AWSTemplateFormatVersion: '2010-09-09'
Resources:
MyLoadBalancer9:
Type: AWS::ElasticLoadBalancingV2::LoadBalancer
Properties:
Type: application
Subnets: !Ref Subnets
Scheme: internet-facing
MyWebACLAssociation:
Type: AWS::WAFv2::WebACLAssociation
Properties:
ResourceArn:
Ref: MyLoadBalancer9
WebACLArn: !GetAtt MyWebACL.Arn