Other Articles

Load Balancer – Enable Deletion Protection

Secure Configuration Checks > AWS

This check ensures that deletion protection is enabled on load balancers. With deletion protection on, a load balancer cannot be deleted by mistake or by an attacker until the setting is turned off first. A deleted load balancer takes the application offline, and a new one gets a new DNS name.

Check Details

  • Resource: Application, Network and Gateway Load Balancer
  • Check: Enable load balancer deletion protection (DeletionProtectionEnabled)
  • Risk: An accidental or malicious delete call removes the load balancer and causes an outage

Remediation via AWS Console

  1. Log in to the AWS Management Console and open the Amazon EC2 console.

    Amazon EC2 Console
  2. In the left navigation pane, under Load Balancing, click Load Balancers and select the affected load balancer.
  3. Open the Attributes tab and click Edit.

    Load balancer attributes tab
  4. Turn on Deletion protection.

    Turn on deletion protection for a load balancer
  5. Click Save changes.
  6. Repeat steps 2 to 5 for every load balancer without deletion protection.

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 load balancers that have deletion protection turned off:

    for arn in $(aws elbv2 describe-load-balancers \
      --query 'LoadBalancers[].LoadBalancerArn' \
      --output text); do
      aws elbv2 describe-load-balancer-attributes \
        --load-balancer-arn "$arn" \
        --query "Attributes[?Key=='deletion_protection.enabled'].Value" \
        --output text | grep -qx true || echo "$arn"
    done
    

    The command covers one region. Add --region <region> to each aws command to check another.

  3. Turn on deletion protection:

    aws elbv2 modify-load-balancer-attributes \
    --load-balancer-arn <load-balancer-arn> \
    --attributes Key=deletion_protection.enabled,Value=true
    
  4. Verify the setting:

    aws elbv2 describe-load-balancer-attributes \
    --load-balancer-arn <load-balancer-arn> \
    --query "Attributes[?Key=='deletion_protection.enabled']" \
    --output table
    

    The value must be true.

Replace <load-balancer-arn> with the ARN of the load balancer, for example arn:aws:elasticloadbalancing:us-east-1:111122223333:loadbalancer/app/my-alb/50dc6c495c0c9188. Repeat steps 3 and 4 for each load balancer that step 2 lists.

Updated on 04 November, 2026