Skip to content

ytkoka/cdk-example-aws-waf

Repository files navigation

CDK example for AWS WAF

This CDK template will deploy a WebACL that includes the baseline rule group of AWS managed rules and a rate-based rule. Also, create a CloudWatch logs group and CloudWatch dashboard for AWS WAF.

WebACL includes the following rules set as COUNT mode:

CloudWatch dashboard is created by the CloudFormation template in the CDK. the dashboard includes the following widgets:

  • Allowed vs Blocked Requests
  • All Counted Requests
  • Top Terminating Rules
  • Top Countries
  • Top IP addresses
  • Top User-agents
  • Top Counted URIs
  • Top Blocked URIs
  • Counted Requests
  • Blocked Requests

Prerequisites

How to deploy

Run

npm install
cdk bootstrap -c webaclName={Your WebACL name} 
cdk deploy -c webaclName={Your WebACL name}  

This CDK template does not include the AWS resource to associate with WebACL. Please associate your AWS resource (CloudFront) to the WebACL created by this template. see here for instructions

Cleanup

Before removing the stack, you will need to disassociate the AWS resource from WebACL manually.

Run

cdk destroy -c webaclName={Your WebACL name}

About

CDK example for AWS WAF

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published