# AWS WAF(V2) IP Restrict Rule
[](https://github.com/gammarers/aws-waf-ip-restrict-rule/blob/main/LICENSE)
[](https://www.npmjs.com/package/@gammarers/aws-waf-ip-restrict-rule)
[](https://pypi.org/project/gammarers.aws-waf-ip-restrict-rule/)
[](https://github.com/gammarers/aws-waf-ip-restrict-rule/actions/workflows/release.yml)
[](https://github.com/gammarers/aws-waf-ip-restrict-rule/releases)
[](https://constructs.dev/packages/@gammarers/aws-waf-ip-restrict-rule)
This is an AWS CDK Construct for IP Restrict Rule on WAF V2
## Install
### TypeScript
#### install by npm
```shell
npm install @gammarers/aws-waf-ip-restrict-rule
```
#### install by yarn
```shell
yarn add @gammarers/aws-waf-ip-restrict-rule
```
### Python
```shell
pip install gammarers.aws-waf-ip-restrict-rule
```
## Example
```python
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/gammarers/aws-waf-ip-restrict-rule.git",
"name": "gammarers.aws-waf-ip-restrict-rule",
"maintainer": null,
"docs_url": null,
"requires_python": "~=3.9",
"maintainer_email": null,
"keywords": null,
"author": "yicr<yicr@users.noreply.github.com>",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/f0/10/2c002fbfb6af9d9ebb67f798d3a25d114926116b4c25427b16e8a483ec4e/gammarers_aws_waf_ip_restrict_rule-2.1.34.tar.gz",
"platform": null,
"description": "# AWS WAF(V2) IP Restrict Rule\n\n[](https://github.com/gammarers/aws-waf-ip-restrict-rule/blob/main/LICENSE)\n[](https://www.npmjs.com/package/@gammarers/aws-waf-ip-restrict-rule)\n[](https://pypi.org/project/gammarers.aws-waf-ip-restrict-rule/)\n[](https://github.com/gammarers/aws-waf-ip-restrict-rule/actions/workflows/release.yml)\n[](https://github.com/gammarers/aws-waf-ip-restrict-rule/releases)\n\n[](https://constructs.dev/packages/@gammarers/aws-waf-ip-restrict-rule)\n\nThis is an AWS CDK Construct for IP Restrict Rule on WAF V2\n\n## Install\n\n### TypeScript\n\n#### install by npm\n\n```shell\nnpm install @gammarers/aws-waf-ip-restrict-rule\n```\n\n#### install by yarn\n\n```shell\nyarn add @gammarers/aws-waf-ip-restrict-rule\n```\n\n### Python\n\n```shell\npip install gammarers.aws-waf-ip-restrict-rule\n```\n\n## Example\n\n```python\nimport { WAFIPRestrictRule } from '@gammarers/aws-waf-ip-restrict-rule';\n\nconst allowedIpSet = new wafv2.CfnIPSet(stack, 'AllowedIpSet', {\n addresses: [\n '203.0.113.0/24',\n '198.51.100.0/24',\n ],\n ipAddressVersion: 'IPV4',\n scope: 'CLOUDFRONT',\n name: 'AllowedIpSet',\n});\n\nconst ipRestrictRule = new WAFIPRestrictRule({\n allowIPSetArn: allowedIpSet.attrArn,\n});\n\nnew wafv2.CfnWebACL(stack, 'WebACL', {\n defaultAction: { allow: {} },\n scope: 'CLOUDFRONT',\n name: 'WebAclWithCustomRules',\n visibilityConfig: {\n cloudWatchMetricsEnabled: true,\n metricName: 'WebAclMetric',\n sampledRequestsEnabled: true,\n },\n rules: [\n ipRestrictRule.allowRule({ priority: 1 }),\n ipRestrictRule.blockRule({ priority: 2 }),\n ],\n});\n```\n\n## License\n\nThis project is licensed under the Apache-2.0 License.\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "This is an AWS CDK Construct for IP Restriction Rule on WAF V2",
"version": "2.1.34",
"project_urls": {
"Homepage": "https://github.com/gammarers/aws-waf-ip-restrict-rule.git",
"Source": "https://github.com/gammarers/aws-waf-ip-restrict-rule.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "71567822a861bfd4b059d337978fde7d2deebf935cb4d343aae4e5fdf72a60a7",
"md5": "278e93ce7c9151fe155f44e1dbe83f67",
"sha256": "c425a2403b67cdfe35f13d03123f32bcf793e57bf1eea885b69bf662f0de544d"
},
"downloads": -1,
"filename": "gammarers_aws_waf_ip_restrict_rule-2.1.34-py3-none-any.whl",
"has_sig": false,
"md5_digest": "278e93ce7c9151fe155f44e1dbe83f67",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.9",
"size": 27539,
"upload_time": "2025-08-25T19:25:51",
"upload_time_iso_8601": "2025-08-25T19:25:51.683714Z",
"url": "https://files.pythonhosted.org/packages/71/56/7822a861bfd4b059d337978fde7d2deebf935cb4d343aae4e5fdf72a60a7/gammarers_aws_waf_ip_restrict_rule-2.1.34-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f0102c002fbfb6af9d9ebb67f798d3a25d114926116b4c25427b16e8a483ec4e",
"md5": "f4fc033e319d0892d077f85413b7f042",
"sha256": "d5450661279d4917e466c860ca118a0207b1e471a23de4baa2c1e259deab1b4a"
},
"downloads": -1,
"filename": "gammarers_aws_waf_ip_restrict_rule-2.1.34.tar.gz",
"has_sig": false,
"md5_digest": "f4fc033e319d0892d077f85413b7f042",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.9",
"size": 28368,
"upload_time": "2025-08-25T19:25:52",
"upload_time_iso_8601": "2025-08-25T19:25:52.673132Z",
"url": "https://files.pythonhosted.org/packages/f0/10/2c002fbfb6af9d9ebb67f798d3a25d114926116b4c25427b16e8a483ec4e/gammarers_aws_waf_ip_restrict_rule-2.1.34.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-25 19:25:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gammarers",
"github_project": "aws-waf-ip-restrict-rule",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "gammarers.aws-waf-ip-restrict-rule"
}