AWS::WAFv2::WebACLAssociation - Amazon CloudFormation
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).



This is the latest version of Amazon WAF , named Amazon WAFV2, released in November, 2019. For information, including how to migrate your Amazon WAF resources from the prior release, see the Amazon WAF developer guide.

Use a web ACL association to define an association between a web ACL and a regional application resource, to protect the resource. A regional application can be an Application Load Balancer (ALB), an Amazon API Gateway REST API, an Amazon AppSync GraphQL API, an Amazon Cognito user pool, an Amazon App Runner service, or an Amazon Verified Access instance.

For Amazon CloudFront, don't use this resource. Instead, use your CloudFront distribution configuration. To associate a web ACL with a distribution, provide the Amazon Resource Name (ARN) of the AWS::WAFv2::WebACL to your CloudFront distribution configuration. To disassociate a web ACL, provide an empty ARN. For information, see AWS::CloudFront::Distribution.

Required permissions for customer-managed IAM policies

This call requires permissions that are specific to the protected resource type. For details, see Permissions for AssociateWebACL in the Amazon WAF Developer Guide.

Temporary inconsistencies during updates

When you create or change a web ACL or other Amazon WAF resources, the changes take a small amount of time to propagate to all areas where the resources are stored. The propagation time can be from a few seconds to a number of minutes.

The following are examples of the temporary inconsistencies that you might notice during change propagation:

  • After you create a web ACL, if you try to associate it with a resource, you might get an exception indicating that the web ACL is unavailable.

  • After you add a rule group to a web ACL, the new rule group rules might be in effect in one area where the web ACL is used and not in another.

  • After you change a rule action setting, you might see the old action in some places and the new action in others.

  • After you add an IP address to an IP set that is in use in a blocking rule, the new address might be blocked in one area while still allowed in another.


To declare this entity in your Amazon CloudFormation template, use the following syntax:


{ "Type" : "AWS::WAFv2::WebACLAssociation", "Properties" : { "ResourceArn" : String, "WebACLArn" : String } }


Type: AWS::WAFv2::WebACLAssociation Properties: ResourceArn: String WebACLArn: String



The Amazon Resource Name (ARN) of the resource to associate with the web ACL.

The ARN must be in one of the following formats:

  • For an Application Load Balancer: arn:partition:elasticloadbalancing:region:account-id:loadbalancer/app/load-balancer-name/load-balancer-id

  • For an Amazon API Gateway REST API: arn:partition:apigateway:region::/restapis/api-id/stages/stage-name

  • For an Amazon AppSync GraphQL API: arn:partition:appsync:region:account-id:apis/GraphQLApiId

  • For an Amazon Cognito user pool: arn:partition:cognito-idp:region:account-id:userpool/user-pool-id

  • For an Amazon App Runner service: arn:partition:apprunner:region:account-id:service/apprunner-service-name/apprunner-service-id

  • For an Amazon Verified Access instance: arn:partition:ec2:region:account-id:verified-access-instance/instance-id

Required: Yes

Type: String

Minimum: 20

Maximum: 2048

Update requires: Replacement


The Amazon Resource Name (ARN) of the web ACL that you want to associate with the resource.

Required: Yes

Type: String

Minimum: 20

Maximum: 2048

Update requires: Replacement

Return values


The Ref for the resource, containing the resource name, physical ID, and scope, formatted as follows: name|id|scope.

For example: my-webacl-name|1234a1a-a1b1-12a1-abcd-a123b123456|REGIONAL.


Create a web ACL association

The following shows an example web ACL association specification.


SampleWebACLAssociation: Type: 'AWS::WAFv2::WebACLAssociation' Properties: WebACLArn: ExampleARNForWebACL ResourceArn: ExampleARNForRegionalResource


"SampleWebACLAssociation": { "Type": "AWS::WAFv2::WebACLAssociation", "Properties": { "WebACLArn": "WebACLArn", "ResourceArn": "APIGatewayOrALBArn" } }