- Newest
- Most votes
- Most comments
Hello,
you will incur charges for ALBs as long as they are active, even if they do not have any target instances. To avoid these charges, ensure you delete the ALB when it is no longer needed.
For additional information, you can check the AWS Elastic Load Balancing pricing page. https://aws.amazon.com/elasticloadbalancing/pricing/
Hi kat,
Check for Unused ALBs:
AWS Management Console:
Go to the EC2 Dashboard. Click on "Load Balancers" under "Load Balancing." Look for ALBs with no instances attached.
AWS CLI:
aws elbv2 describe-load-balancers --query 'LoadBalancers[*].[LoadBalancerName, LoadBalancerArn, State.Code]'
aws elbv2 describe-target-groups --load-balancer-arn <your-load-balancer-arn> --query 'TargetGroups[*].TargetGroupArn'
aws elbv2 describe-target-health --target-group-arn <your-target-group-arn> --query 'TargetHealthDescriptions[*].Target'
Delete Unused ALBs:
AWS Management Console:
In the EC2 Dashboard, select the ALB. Click "Actions" and select "Delete."
aws elbv2 delete-load-balancer --load-balancer-arn <your-load-balancer-arn>
Automate Cleanup (Optional):
- AWS Config Rules: Set up rules to detect and notify you about unused ALBs.
- **Lambda Function: **Use a Lambda function to periodically check and delete unused ALBs.
Example Lambda function:
import boto3
client = boto3.client('elbv2')
def lambda_handler(event, context):
load_balancers = client.describe_load_balancers()
for lb in load_balancers['LoadBalancers']:
lb_arn = lb['LoadBalancerArn']
target_groups = client.describe_target_groups(LoadBalancerArn=lb_arn)
for tg in target_groups['TargetGroups']:
tg_arn = tg['TargetGroupArn']
targets = client.describe_target_health(TargetGroupArn=tg_arn)
if not targets['TargetHealthDescriptions']:
print(f"Deleting ALB: {lb['LoadBalancerName']} with no targets")
client.delete_load_balancer(LoadBalancerArn=lb_arn)
return {'statusCode': 200, 'body': 'Checked and deleted unused ALBs'}
thank you! Appreciate it
Note that this post doesn't answer the question about whether billing will happen or not - that is covered in the other posts.
Yes, you'll be charged for ALBs for as long as they exist, regardless of whether they have listeners or if the listeners are pointing to any target groups or if the target groups contain any targets.
thank you! Appreciate it
Relevant content
asked 3 years ago
asked 5 years ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated a year ago

thank you! Appreciate it