Skip to content

gammarers/aws-waf-ip-rate-limit-rule

Repository files navigation

AWS WAF(V2) IP Rete Limit Rule

GitHub npm (scoped) PyPI GitHub Workflow Status (branch) GitHub release (latest SemVer)

View on Construct Hub

This is an AWS CDK WAF IP Rate Limit Rule

Resources

This construct creating resource list.

  • WAF V2 RuleGroup

Install

TypeScript

install by npm

npm install @gammarers/aws-waf-ip-rate-limit-rule

install by yarn

yarn add @gammarers/aws-waf-ip-rate-limit-rule

Python

pip install gammarers.aws-waf-ip-rate-limit-rule

Example

import { WAFIPRateLimitRule } from '@gammarers/aws-waf-ip-rate-limit-rule';

const ipRateLimitRule = new WAFIPRateLimitRule({
  rateLimit: 100,
});

new wafv2.CfnWebACL(stack, 'WebACL', {
  defaultAction: { allow: {} },
  scope: 'CLOUD_FRONT',
  name: 'WebAclWithCustomRules',
  visibilityConfig: {
    cloudWatchMetricsEnabled: true,
    metricName: 'WebAclMetric',
    sampledRequestsEnabled: true,
  },
  rules: [
    ipRateLimitRule.blockRule({
      priority: 1,
    }),
  ],
});

License

This project is licensed under the Apache-2.0 License.