:doc:`AutoScaling <../../autoscaling>` / Client / detach_load_balancers

*********************
detach_load_balancers
*********************



.. py:method:: AutoScaling.Client.detach_load_balancers(**kwargs)

  

  .. note::

    

    This API operation is superseded by `DetachTrafficSources <https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DetachTrafficSources.html>`__, which can detach multiple traffic sources types. We recommend using ``DetachTrafficSources`` to simplify how you manage traffic sources. However, we continue to support ``DetachLoadBalancers``. You can use both the original ``DetachLoadBalancers`` API operation and ``DetachTrafficSources`` on the same Auto Scaling group.

    

   

  Detaches one or more Classic Load Balancers from the specified Auto Scaling group.

   

  This operation detaches only Classic Load Balancers. If you have Application Load Balancers, Network Load Balancers, or Gateway Load Balancers, use the `DetachLoadBalancerTargetGroups <https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DetachLoadBalancerTargetGroups.html>`__ API instead.

   

  When you detach a load balancer, it enters the ``Removing`` state while deregistering the instances in the group. When all instances are deregistered, then you can no longer describe the load balancer using the `DescribeLoadBalancers <https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeLoadBalancers.html>`__ API call. The instances remain running.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DetachLoadBalancers>`_  


  **Request Syntax**
  ::

    response = client.detach_load_balancers(
        AutoScalingGroupName='string',
        LoadBalancerNames=[
            'string',
        ]
    )
    
  :type AutoScalingGroupName: string
  :param AutoScalingGroupName: **[REQUIRED]** 

    The name of the Auto Scaling group.

    

  
  :type LoadBalancerNames: list
  :param LoadBalancerNames: **[REQUIRED]** 

    The names of the load balancers. You can specify up to 10 load balancers.

    

  
    - *(string) --* 

    

  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {}
      
    **Response Structure**

    

    - *(dict) --* 
  
  **Exceptions**
  
  *   :py:class:`AutoScaling.Client.exceptions.ResourceContentionFault`

  

  **Examples**

  This example detaches the specified load balancer from the specified Auto Scaling group.
  ::

    response = client.detach_load_balancers(
        AutoScalingGroupName='my-auto-scaling-group',
        LoadBalancerNames=[
            'my-load-balancer',
        ],
    )
    
    print(response)

  
  Expected Output:
  ::

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

  