https://github.com/gammarers/aws-waf-geo-restrict-rule
This is an AWS CDK Geo Restriction Rule Group on WAF V2
https://github.com/gammarers/aws-waf-geo-restrict-rule
aws aws-cdk cdk geo restrict waf
Last synced: 3 months ago
JSON representation
This is an AWS CDK Geo Restriction Rule Group on WAF V2
- Host: GitHub
- URL: https://github.com/gammarers/aws-waf-geo-restrict-rule
- Owner: gammarers
- License: apache-2.0
- Created: 2023-07-28T03:46:33.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-07T19:26:30.000Z (3 months ago)
- Last Synced: 2025-04-09T22:07:18.170Z (3 months ago)
- Topics: aws, aws-cdk, cdk, geo, restrict, waf
- Language: TypeScript
- Homepage:
- Size: 1.57 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AWS WAF(v2) GEO Restrict Rule
[](https://github.com/gammarers/aws-waf-geo-restrict-rule/blob/main/LICENSE)
[](https://www.npmjs.com/package/@gammarers/aws-waf-geo-restrict-rule)
[](https://pypi.org/project/gammarers.aws-waf-geo-restrict-rule/)
[](https://github.com/gammarers/aws-waf-geo-restrict-rule/actions/workflows/release.yml)
[](https://github.com/gammarers/aws-waf-geo-restrict-rule/releases)[](https://constructs.dev/packages/@gammarers/aws-waf-geo-restrict-rule)
This is an AWS CDK WAF Geo Restrict Rule on WAF V2
## Install
### TypeScript
#### install by npm
```shell
npm install @gammarers/aws-waf-geo-restrict-rule
```#### install by yarn
```shell
yarn add @gammarers/aws-waf-geo-restrict-rule
```### Python
```shell
pip install gammarers.aws-waf-geo-restrict-rule
```## Example
```typescript
import { WAFGeoRestrictRule } from '@gammarers/aws-waf-geo-restrict-rule';const geoRestrictRule = new WAFGeoRestrictRule({
allowCountries: ['JP'],
});new wafv2.CfnWebACL(stack, 'WebACL', {
defaultAction: { allow: {} },
scope: 'CLOUD_FRONT',
name: 'WebAclWithCustomRules',
visibilityConfig: {
cloudWatchMetricsEnabled: true,
metricName: 'WebAclMetric',
sampledRequestsEnabled: true,
},
rules: [
geoRestrictRule.allowRule({
priority: 1,
}),
geoRestrictRule.blockRule({
priority: 2,
}),
],
});```
## License
This project is licensed under the Apache-2.0 License.