0

I want to Create and Attach a WAF to my loadbalancer.

what are the resources and parameters i need to attach to create a WAF, is there any example, You can suggest me?

I tried this way but each rule set is failed using cloudformation template.

MyWebACL = t.add_resource(
    WebACL(
        "MyWebACL",
        Name=Ref(WebACLName),
        DefaultAction=Action(
            Type="ALLOW"
        ),
        Rules=[
            Rules(
                Action=Action(
                    Type="BLOCK"
                ),
                Priority=1,
                RuleId=Ref(ManualIPBlockRule)
            ),
            Rules(
                Action=Action(
                    Type="COUNT"
                ),
                Priority=2,
                RuleId=Ref(SizeMatchRule)
            ),
            Rules(
                Action=Action(
                    Type="BLOCK"
                ),
                Priority=3,
                RuleId=Ref(SqliRule)
            ),
            Rules(
                Action=Action(
                    Type="BLOCK"
                ),
                Priority=4,
                RuleId=Ref(XssRule)
            )
        ],
        MetricName=(),
    ))

Here are my one example rule:

SizeMatchRule = t.add_resource(
    Rule(
        "SizeMatchRule",
        Name=Join("", [Ref(WebACLName), "LargeBodyMatchRule"]),
        MetricName=Join("", [Ref(WebACLName), "DetectLargeBody"]),
        Predicates=[
            Predicates(
                DataId=Ref(SizeMatchSet),
                Type="SizeConstraint",
                Negated=False
            )
        ]
    ))

Any suggestion and reference let me know?

neuro
  • 14,948
  • 3
  • 36
  • 59
Rajat jain
  • 1,715
  • 3
  • 12
  • 21
  • Server and Network Infrastructure questions are answered on [Server Fault](https://serverfault.com/). – Klaus D. Feb 14 '19 at 09:51
  • This is related to `AWS cloudformation`, using `python Library` – Rajat jain Feb 14 '19 at 10:05
  • @Rajatjain, don't add Python tags to these questions unless they are specifically questions about Python. That way you will avoid Python developers voting to close your questions. Also, this question is really about Cloudformation, not Troposphere. You are more likely to get an answer if you say what it is you don't know how to do in Cloudformation. After all, not many people will know Troposphere, but plenty know Cloudformation. – Alex Harvey Feb 14 '19 at 10:11

0 Answers0