AutoScaling / Client / detach_load_balancer_target_groups

detach_load_balancer_target_groups#

AutoScaling.Client.detach_load_balancer_target_groups(**kwargs)#

Detaches one or more target groups from the specified Auto Scaling group.

When you detach a target group, it enters the Removing state while deregistering the instances in the group. When all instances are deregistered, then you can no longer describe the target group using the DescribeLoadBalancerTargetGroups API call. The instances remain running.

Note

You can use this operation to detach target groups that were attached by using AttachLoadBalancerTargetGroups, but not for target groups that were attached by using AttachTrafficSources.

See also: AWS API Documentation

Request Syntax

response = client.detach_load_balancer_target_groups(
    AutoScalingGroupName='string',
    TargetGroupARNs=[
        'string',
    ]
)
Parameters:
  • AutoScalingGroupName (string) –

    [REQUIRED]

    The name of the Auto Scaling group.

  • TargetGroupARNs (list) –

    [REQUIRED]

    The Amazon Resource Names (ARN) of the target groups. You can specify up to 10 target groups.

    • (string) –

Return type:

dict

Returns:

Response Syntax

{}

Response Structure

  • (dict) –

Exceptions

  • AutoScaling.Client.exceptions.ResourceContentionFault

Examples

This example detaches the specified target group from the specified Auto Scaling group

response = client.detach_load_balancer_target_groups(
    AutoScalingGroupName='my-auto-scaling-group',
    TargetGroupARNs=[
        'arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067',
    ],
)

print(response)

Expected Output:

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