Skip to content

Instantly share code, notes, and snippets.

@vvucetic
Last active October 30, 2020 09:24
Show Gist options
  • Save vvucetic/94658306cd89c3feefad3e0609d71d34 to your computer and use it in GitHub Desktop.
Save vvucetic/94658306cd89c3feefad3e0609d71d34 to your computer and use it in GitHub Desktop.
Resources:
RateLimitACL:
Type: AWS::WAFv2::WebACL
Properties:
Name: rate-limit-acl
Scope: REGIONAL
Description: Auto-generated rate-limiting ACL.
DefaultAction:
Allow: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: rate-limit-acl
Rules:
- Name: rate-limit-bar
Priority: 1
Action:
Block: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: rate-limit-bar
Statement:
RateBasedStatement:
AggregateKeyType: "IP"
Limit: 100
ScopeDownStatement:
ByteMatchStatement:
SearchString: "/bar/"
FieldToMatch:
UriPath: {}
TextTransformations:
- Type: URL_DECODE
Priority: 0
PositionalConstraint: "STARTS_WITH"
- Name: rate-limit-foo
Priority: 2
Action:
Block: {}
VisibilityConfig:
SampledRequestsEnabled: true
CloudWatchMetricsEnabled: true
MetricName: rate-limit-foo
Statement:
RateBasedStatement:
AggregateKeyType: "IP"
Limit: 500
ScopeDownStatement:
ByteMatchStatement:
SearchString: "/foo/"
FieldToMatch:
UriPath: {}
TextTransformations:
- Type: URL_DECODE
Priority: 0
PositionalConstraint: "STARTS_WITH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment