Add deny list using AWS WAF
AWS WAF allows setting rate limits and regular rules based on IP addresses. Follow these instructions to deny a set of IP addresses from accessing the solution.
Note
Use the main account to add a deny list.
Step 1: Create web ACL
Sign in to the AWS Management Console and open the AWS WAF console at https://console.aws.amazon.com/wafv2/
. -
In the navigation pane, under AWS WAF, choose Web ACLs.
-
Choose Create Web ACL.
-
For Name, enter the name that you will use to identify this web ACL.
-
(Optional) For Description - optional, enter a longer description for the web ACL.
-
For CloudWatch metric name, change the default name if applicable. Follow the console guidance for valid characters. The name cannot contain special characters, white spaces, or metric names reserved for AWS WAF, including
All
andDefault_Action
. -
For Resource type, choose Regional resources. Select the region that RSW is deployed in.
-
For Associated AWS resources, choose Add AWS resources.
-
In the Add AWS resources dialog box, choose Application Load Balancer.
-
Select the Application Load Balancer deployed as part of the solution's CloudFormation stack. The name of the Application Load Balancer can be found by searching for the key
MainAccountLoadBalancerArnOutput
in the RSW Cloudformation stack Outputs. -
Choose Next.
-
In Add rules and rule groups, choose Next.
-
In Set rule priority, choose Next.
-
In Configure metrics, choose Next.
-
In Review and create web ACL, choose Create web ACL.
Step 2: Create a deny list IP set
Sign in to the AWS Management Console and open the AWS WAF console at https://console.aws.amazon.com/wafv2/
. -
In the navigation pane, under AWS WAF, choose IP sets. and then Create IP set.
-
Choose Create IP set.
-
For IP set name, enter
DenyList
. -
For Region, choose the region where you deployed the solution.
-
For IP addresses, add the IP addresses you would like to deny.
-
Choose Create IP set.
Step 3: Add a deny list rule
-
Open the web ACL created previously.
-
Choose the Rules tab.
-
From Add rules, choose Add my rules and rule groups.
-
For Rule type, choose Rule builder.
-
For Rule builder, choose Rule visual editor.
-
For Name, enter
DenyListRule
. -
For Type, choose Regular rule.
-
For If a request, choose matches the statement.
-
For Inspect under Statement, choose Originate from an IP address in.
-
For IP set, choose DenyList.
-
For Action, choose Block.
-
Choose Add rule.
Additional rules can be added to block or limit access to the solution's APIs as required for compliance or user needs. For more information, see AWS WAF rules.