AWS WAF(V2) IP Restrict Rule
This is an AWS CDK Construct for IP Restrict Rule on WAF V2
Install
TypeScript
install by npm
npm install @gammarers/aws-waf-ip-restrict-rule
install by yarn
yarn add @gammarers/aws-waf-ip-restrict-rule
Python
pip install gammarers.aws-waf-ip-restrict-rule
Example
import { WAFIPRestrictRule } from '@gammarers/aws-waf-ip-restrict-rule';
const allowedIpSet = new wafv2.CfnIPSet(stack, 'AllowedIpSet', {
addresses: [
'203.0.113.0/24',
'198.51.100.0/24',
],
ipAddressVersion: 'IPV4',
scope: 'CLOUDFRONT',
name: 'AllowedIpSet',
});
const ipRestrictRule = new WAFIPRestrictRule({
allowIPSetArn: allowedIpSet.attrArn,
});
new wafv2.CfnWebACL(stack, 'WebACL', {
defaultAction: { allow: {} },
scope: 'CLOUDFRONT',
name: 'WebAclWithCustomRules',
visibilityConfig: {
cloudWatchMetricsEnabled: true,
metricName: 'WebAclMetric',
sampledRequestsEnabled: true,
},
rules: [
ipRestrictRule.allowRule({ priority: 1 }),
ipRestrictRule.blockRule({ priority: 2 }),
],
});
License
This project is licensed under the Apache-2.0 License.
Metadata
Release files for gammarers.aws-waf-ip-restrict-rule 2.1.55
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gammarers_aws_waf_ip_restrict_rule-2.1.55.tar.gz | 28.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gammarers_aws_waf_ip_restrict_rule-2.1.55-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 55.9 kB
Release files / gammarers_aws_waf_ip_restrict_rule-2.1.55.tar.gz
| Download URL | gammarers_aws_waf_ip_restrict_rule-2.1.55.tar.gz |
|---|---|
| Size | 28.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c02df225a1c9575af0021fc620f4c2709181fac0e023aecaa566cadbf0572bdf
|
|
BLAKE2b-256 checksum How to use checksums |
ec835b363be8bfc7fd95017c3bc5c227429f61a6c269201ddb9c8e13847bb034
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.14.2
|
Release files / gammarers_aws_waf_ip_restrict_rule-2.1.55-py3-none-any.whl
| Download URL | gammarers_aws_waf_ip_restrict_rule-2.1.55-py3-none-any.whl |
|---|---|
| Size | 27.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f9b349c9283350981e97457f15f2e4485a797b6810b25ba46377397e21737279
|
|
BLAKE2b-256 checksum How to use checksums |
fdbd8cde4a48cb84cf47e67a7d4cbb579973841021ad8a75ff87cfdcd21cdf13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.14.2
|