Skip to content

Commit 76017f9

Browse files
updated readme with waf info
1 parent af3fdda commit 76017f9

File tree

2 files changed

+30
-23
lines changed

2 files changed

+30
-23
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,13 @@ Prospector works fine if you have no __init__ files, or if you have __init__ fil
274274

275275
Until the unittest library is fixed (and no __init__ files are needed), __init__ are needed in all tests folders.
276276

277+
# A Note on setting up a Web Application Firewall for Api Gateway
278+
279+
You can enable a Web Application Firewall (AWS WAF) for Api Gateway by uncommenting some lines in *template.yaml*. This has a cost, however, of at least $5 per calendar month at the time of writing.
280+
281+
To enable AWS WAF for Api Gateway, uncomment lines 73 to 95 of *template.yaml*.
282+
283+
To only deploy a WAF for your staging and production APIs, uncomment lines 21, 22, 75 and 90 in the same file. This will stop creating the resources in your dev environment only.
277284

278285
[comment]: <> ([build-status]: https://codebuild.eu-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiYWNqUHZHVUFaR0NWYUtsYndvUWVkbGkyL240OCtYVlBMaVJ3SkU2cVZYN1hKeVRtdkllSHU4ZDlCdzJsK1NSczYxVCtXVGZhSEs2QkxzTWlpYlpDdnJBPSIsIml2UGFyYW1ldGVyU3BlYyI6Ik1haWpIZE5RYlNGWS9vZnUiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master)
279286
[mit-license-svg]: https://img.shields.io/badge/License-MIT-yellow.svg

template.yaml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -70,29 +70,29 @@ Resources:
7070
Location: !Sub s3://${S3Bucket}/api-contract.yaml
7171
StageName: Prod
7272

73-
# WAF
74-
ApiGatewayWebACL:
75-
# Condition: CreateProdResources
76-
DependsOn: ApiGateway
77-
Type: AWS::WAFv2::WebACL
78-
Properties:
79-
DefaultAction:
80-
Allow: { }
81-
# no rules defined, allow all for now.
82-
# See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-webacl.html#cfn-wafv2-webacl-rules
83-
Scope: REGIONAL
84-
VisibilityConfig:
85-
CloudWatchMetricsEnabled: True
86-
MetricName: ApiGatewayWAFMetric
87-
SampledRequestsEnabled: False
88-
89-
ApiGatewayACLAssociation:
90-
# Condition: CreateProdResources
91-
DependsOn: ApiGateway
92-
Type: AWS::WAFv2::WebACLAssociation
93-
Properties:
94-
ResourceArn: !Sub arn:aws:apigateway:${AWS::Region}::/restapis/${ApiGateway}/stages/Prod
95-
WebACLArn: !GetAtt ApiGatewayWebACL.Arn
73+
# # WAF
74+
# ApiGatewayWebACL:
75+
## Condition: CreateProdResources
76+
# DependsOn: ApiGateway
77+
# Type: AWS::WAFv2::WebACL
78+
# Properties:
79+
# DefaultAction:
80+
# Allow: { }
81+
# # no rules defined, allow all for now.
82+
# # See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-wafv2-webacl.html#cfn-wafv2-webacl-rules
83+
# Scope: REGIONAL
84+
# VisibilityConfig:
85+
# CloudWatchMetricsEnabled: True
86+
# MetricName: ApiGatewayWAFMetric
87+
# SampledRequestsEnabled: False
88+
#
89+
# ApiGatewayACLAssociation:
90+
## Condition: CreateProdResources
91+
# DependsOn: ApiGateway
92+
# Type: AWS::WAFv2::WebACLAssociation
93+
# Properties:
94+
# ResourceArn: !Sub arn:aws:apigateway:${AWS::Region}::/restapis/${ApiGateway}/stages/Prod
95+
# WebACLArn: !GetAtt ApiGatewayWebACL.Arn
9696

9797
ALambdaLogGroup:
9898
Type: AWS::Logs::LogGroup

0 commit comments

Comments
 (0)