Other Articles

CloudFront Distribution – Associate a WAF Web ACL

Secure Configuration Checks > AWS

This check ensures that every CloudFront distribution has an AWS WAF web ACL associated with it. A web ACL filters malicious requests before they reach your application.

Check Details

  • Resource: CloudFront Distribution
  • Check: Associate a WAF web ACL with CloudFront (WebACLAssociated)
  • Risk: Web attacks and bots can reach the application and disrupt it

Remediation via AWS Console

  1. Open the Amazon CloudFront console and select the affected distribution.

    Amazon CloudFront Console
  2. Open the Security tab and click (Enable/Disable protections) under Web Application Firewall (WAF).

    CloudFront Security tab
  3. Ensure Use monitor mode is unchecked so WAF actively blocks malicious requests.

  4. Click Save changes and verify that WAF protection is active.

Note: WAF protections are included by default. Monitor mode only monitors threats without blocking them. Layer 7 DDoS protection requires the Business plan.

Remediation via AWS CLI

  1. Log in to the AWS Management Console and click the CloudShell icon (>_) in the top-right corner.

    AWS CloudShell
  2. List the CloudFront web ACLs and note the ARN of the one to use:

    aws wafv2 list-web-acls \
    --scope CLOUDFRONT \
    --region us-east-1 \
    --query 'WebACLs[*].[Name,ARN]' \
    --output table
    
  3. Download the current distribution configuration:

    aws cloudfront get-distribution-config \
    --id <distribution-id> > dist-config.json
    
  4. Set the web ACL in the configuration:

    WEB_ACL_ARN="<web-acl-arn>"
    ETAG=$(jq -r '.ETag' dist-config.json)
    
    jq --arg arn "$WEB_ACL_ARN" '.DistributionConfig
    | .WebACLId = $arn' \
     dist-config.json > updated-config.json
    
    
  5. Apply the updated configuration:

    aws cloudfront update-distribution \
    --id <distribution-id> \
    --if-match "$ETAG" \
    --distribution-config file://updated-config.json
    
  6. Verify that the web ACL is associated:

    aws cloudfront get-distribution-config \
    --id <distribution-id> \
    --query 'DistributionConfig.WebACLId'
    

Replace <distribution-id> with your distribution ID, for example E1ABCDEF234567. Replace <web-acl-arn> with the ARN from step 2.

Updated on 03 November, 2026