Use existing WAF rules in Cloudformation template

Hi Guys,
I tried searching for a solution but could not find anything. I want tu use my existing WAF rules in in my Cloudformation template but dont know how. If i just try to add extra rules, i then reach the limit of 100 and stack creation fails because of that. I dont want to increase the limit of 100 WAF rules. Can anyone help please?
  • post-author-pic
    Michael M


    This is a per account limit and to get past this you would need to request an increase.
    Can you audit the rules to determine if they are all needed and none are duplicated?

  • post-author-pic

    Thnks Michael. I am aware of that, i dont want to increase my limit above 100 rules. I just want to know how i can refer to existing rules in my new cloudformation template instead of creating rules that do exactly the same as the existing ones.!

  • post-author-pic
    Craig A

    Hello. I've not done it, but I believe you can refer to the existing rule(s) in your template by referencing the existing rule name in your template:


    "Type" : "AWS::WAF::Rule",

    "Properties" : {

    "MetricName" : String,

    "Name" : String, <------- add the existing name here

    "Predicates" : [ Predicate, ... ]



    Another thing I've found useful is CloudFormer. It can be used to reverse engineer a template from your existing resources. The resulting template may not be perfect, but it can save a lot of time. 

    Check out this lesson on CloudFormer in our CloudFormation Deep Dive (if you're not familiar with it):

Looking For Team Training?

Learn More