Configures a rate-based rule to limit requests from US and NL IP addresses on CloudFront distributions.

Terraform Template

resource "aws_wafv2_web_acl" "example" {
  description = "Example of a Cloudfront rate based statement."
  name = "rate-based-example"

  rule {
    name = "rule-1"
    priority = 1

    visibility_config {
      cloudwatch_metrics_enabled = false
      metric_name = "friendly-rule-metric-name"
      sampled_requests_enabled = false
    }
  }
  scope = "CLOUDFRONT"

  tags = {
    Tag1 = "Value1"
    Tag2 = "Value2"
  }

  visibility_config {
    cloudwatch_metrics_enabled = false
    metric_name = "friendly-metric-name"
    sampled_requests_enabled = false
  }
}