delete_load_balancer

delete_load_balancer(**kwargs)

Deletes the specified Application Load Balancer, Network Load Balancer, or Gateway Load Balancer. Deleting a load balancer also deletes its listeners.

You can't delete a load balancer if deletion protection is enabled. If the load balancer does not exist or has already been deleted, the call succeeds.

Deleting a load balancer does not affect its registered targets. For example, your EC2 instances continue to run and are still registered to their target groups. If you no longer need these EC2 instances, you can stop or terminate them.

See also: AWS API Documentation

Request Syntax

response = client.delete_load_balancer(
    LoadBalancerArn='string'
)
Parameters
LoadBalancerArn (string) --

[REQUIRED]

The Amazon Resource Name (ARN) of the load balancer.

Return type
dict
Returns
Response Syntax
{}

Response Structure

  • (dict) --

Exceptions

  • ElasticLoadBalancingv2.Client.exceptions.LoadBalancerNotFoundException
  • ElasticLoadBalancingv2.Client.exceptions.OperationNotPermittedException
  • ElasticLoadBalancingv2.Client.exceptions.ResourceInUseException

Examples

This example deletes the specified load balancer.

response = client.delete_load_balancer(
    LoadBalancerArn='arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188',
)

print(response)

Expected Output:

{
    'ResponseMetadata': {
        '...': '...',
    },
}