Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gammarers/aws-waf-ip-restrict-rule
This is an AWS CDK Construct for IP Restriction Rule Group on WAF V2
https://github.com/gammarers/aws-waf-ip-restrict-rule
aws aws-cdk cdk ip restrict waf
Last synced: 6 days ago
JSON representation
This is an AWS CDK Construct for IP Restriction Rule Group on WAF V2
- Host: GitHub
- URL: https://github.com/gammarers/aws-waf-ip-restrict-rule
- Owner: gammarers
- License: apache-2.0
- Created: 2023-08-02T07:52:57.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-23T11:34:23.000Z (11 days ago)
- Last Synced: 2024-12-23T11:54:49.664Z (11 days ago)
- Topics: aws, aws-cdk, cdk, ip, restrict, waf
- Language: TypeScript
- Homepage:
- Size: 878 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AWS WAF(V2) IP Restrict Rule
[![GitHub](https://img.shields.io/github/license/gammarers/aws-waf-ip-restrict-rule?style=flat-square)](https://github.com/gammarers/aws-waf-ip-restrict-rule/blob/main/LICENSE)
[![npm (scoped)](https://img.shields.io/npm/v/@gammarers/aws-waf-ip-restrict-rule?style=flat-square)](https://www.npmjs.com/package/@gammarers/aws-waf-ip-restrict-rule)
[![PyPI](https://img.shields.io/pypi/v/gammarers.aws-waf-ip-restrict-rule?style=flat-square)](https://pypi.org/project/gammarers.aws-waf-ip-restrict-rule/)
[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/gammarers/aws-waf-ip-restrict-rule/release.yml?branch=main&label=release&style=flat-square)](https://github.com/gammarers/aws-waf-ip-restrict-rule/actions/workflows/release.yml)
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/gammarers/aws-waf-ip-restrict-rule?sort=semver&style=flat-square)](https://github.com/gammarers/aws-waf-ip-restrict-rule/releases)[![View on Construct Hub](https://constructs.dev/badge?package=@gammarers/aws-waf-ip-restrict-rule)](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
```typescript
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.