CmdID / aws / aws cloudfront
aws cloudfront associate-distribution-web-acl
Associates the WAF web ACL with a distribution. AWS CLI reference
1 example 3 options Its page in the AWS CLI reference
Examples
To associate a web ACL with a CloudFront distribution
The following associate-distribution-web-acl example associates a web ACL with a CloudFront distribution.
aws cloudfront associate-distribution-web-acl --id E1XNX8R2GOAABC --if-match E2YWS1C2J3OABC --web-acl-arn arn:aws:wafv2:us-east-1:123456789012:global/webacl/web-global-example/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111Identify--idThe ID of the distribution.--if-matchThe value of the ETag header that you received when retrieving the distribution that you're associating with the WAF web ACL.--web-acl-arnThe Amazon Resource Name (ARN) of the WAF web ACL to associate.Its output
{
"ETag": "E3QE7ED60U0ABC",
"Id": "E1XNX8R2GOAABC",
"WebACLArn": "arn:aws:wafv2:us-east-1:123456789012:global/webacl/web-global-example/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"
}For more information, see Use AWS WAF protections in the Amazon CloudFront Developer Guide.
Options
--idThe ID of the distribution.--if-matchThe value of the ETag header that you received when retrieving the distribution that you're associating with the WAF web ACL.--web-acl-arnThe Amazon Resource Name (ARN) of the WAF web ACL to associate.