Skip to content

IPSet

Source: src/AWS/WAFv2/IPSet.ts

An AWS WAFv2 IP set — a named collection of IP addresses and CIDR ranges referenced from web ACL and rule group rules via IPSetReferenceStatement.

Block List of IPv4 Addresses

const blockList = yield* AWS.WAFv2.IPSet("BlockList", {
addresses: ["192.0.2.44/32", "203.0.113.0/24"],
});

Reference from a Web ACL Rule

const acl = yield* AWS.WAFv2.WebACL("Firewall", {
rules: [
{
Name: "block-bad-ips",
Priority: 0,
Statement: {
IPSetReferenceStatement: { ARN: blockList.ipSetArn },
},
Action: { Block: {} },
VisibilityConfig: {
SampledRequestsEnabled: true,
CloudWatchMetricsEnabled: true,
MetricName: "block-bad-ips",
},
},
],
});