@gammarers/aws-waf-geo-restrict-rule
Version:
This is an AWS CDK Geo Restric Rule on WAF V2
68 lines (49 loc) • 2.16 kB
Markdown
# 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.