This API operation is superseded by DescribeTrafficSources, which can describe multiple traffic sources types. We recommend using DetachTrafficSources to simplify how you manage traffic sources. However, we continue to support DescribeLoadBalancerTargetGroups. You can use both the original DescribeLoadBalancerTargetGroups API operation and DescribeTrafficSources on the same Auto Scaling group.
Gets information about the Elastic Load Balancing target groups for the specified Auto Scaling group.
To determine the attachment status of the target group, use the State element in the response. When you attach a target group to an Auto Scaling group, the initial State value is Adding. The state transitions to Added after all Auto Scaling instances are registered with the target group. If Elastic Load Balancing health checks are enabled for the Auto Scaling group, the state transitions to InService after at least one Auto Scaling instance passes the health check. When the target group is in the InService state, Amazon EC2 Auto Scaling can terminate and replace any instances that are reported as unhealthy. If no registered instances pass the health checks, the target group doesn't enter the InService state.
Target groups also have an InService state if you attach them in the CreateAutoScalingGroup API call. If your target group state is InService, but it is not working properly, check the scaling activities by calling DescribeScalingActivities and take any corrective actions necessary.
For help with failed health checks, see Troubleshooting Amazon EC2 Auto Scaling: Health checks in the Amazon EC2 Auto Scaling User Guide. For more information, see Use Elastic Load Balancing to distribute traffic across the instances in your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
You can use this operation to describe target groups that were attached by using AttachLoadBalancerTargetGroups, but not for target groups that were attached by using AttachTrafficSources.
Parameters:
-
auto_scaling_group_name
(Optional[XmlStringMaxLen255], default:
None
)
–
The name of the Auto Scaling group.
-
next_token
(Optional[XmlString], default:
None
)
–
The token for the next set of items to return. (You received this token from a previous call.)
-
max_records
(Optional[MaxRecords], default:
None
)
–
The maximum number of items to return with this call. The default value is 100 and the maximum value is 100.
Raises:
-
InvalidNextToken
–
The NextToken value is not valid.
-
ResourceContentionFault
–
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
To describe the target groups for an Auto Scaling group
This example describes the target groups attached to the specified Auto Scaling group.
>>> await client.describe_load_balancer_target_groups(auto_scaling_group_name='my-auto-scaling-group')
Source code in docs_src/capo_auto_scaling/_services/async_auto_scaling.py
| async def describe_load_balancer_target_groups(
self,
*,
config_overrides: Optional[AsyncAutoScalingClientConfig] = None,
auto_scaling_group_name: Optional[
"capo_auto_scaling.types.xml_string_max_len255.XmlStringMaxLen255"
] = None,
next_token: Optional["capo_auto_scaling.types.xml_string.XmlString"] = None,
max_records: Optional["capo_auto_scaling.types.max_records.MaxRecords"] = None,
) -> "capo_auto_scaling.types.describe_load_balancer_target_groups_response.DescribeLoadBalancerTargetGroupsResponse":
"""<note> <p>This API operation is superseded by <a href="https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeTrafficSources.html">DescribeTrafficSources</a>, which can describe multiple traffic sources types. We recommend using <code>DetachTrafficSources</code> to simplify how you manage traffic sources. However, we continue to support <code>DescribeLoadBalancerTargetGroups</code>. You can use both the original <code>DescribeLoadBalancerTargetGroups</code> API operation and <code>DescribeTrafficSources</code> on the same Auto Scaling group.</p> </note> <p>Gets information about the Elastic Load Balancing target groups for the specified Auto Scaling group.</p> <p>To determine the attachment status of the target group, use the <code>State</code> element in the response. When you attach a target group to an Auto Scaling group, the initial <code>State</code> value is <code>Adding</code>. The state transitions to <code>Added</code> after all Auto Scaling instances are registered with the target group. If Elastic Load Balancing health checks are enabled for the Auto Scaling group, the state transitions to <code>InService</code> after at least one Auto Scaling instance passes the health check. When the target group is in the <code>InService</code> state, Amazon EC2 Auto Scaling can terminate and replace any instances that are reported as unhealthy. If no registered instances pass the health checks, the target group doesn't enter the <code>InService</code> state. </p> <p>Target groups also have an <code>InService</code> state if you attach them in the <a href="https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_CreateAutoScalingGroup.html">CreateAutoScalingGroup</a> API call. If your target group state is <code>InService</code>, but it is not working properly, check the scaling activities by calling <a href="https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeScalingActivities.html">DescribeScalingActivities</a> and take any corrective actions necessary.</p> <p>For help with failed health checks, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/ts-as-healthchecks.html">Troubleshooting Amazon EC2 Auto Scaling: Health checks</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>. For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-load-balancer.html">Use Elastic Load Balancing to distribute traffic across the instances in your Auto Scaling group</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>. </p> <note> <p>You can use this operation to describe target groups that were attached by using <a href="https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_AttachLoadBalancerTargetGroups.html">AttachLoadBalancerTargetGroups</a>, but not for target groups that were attached by using <a href="https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_AttachTrafficSources.html">AttachTrafficSources</a>.</p> </note>
Args:
auto_scaling_group_name: <p>The name of the Auto Scaling group.</p>
next_token: <p>The token for the next set of items to return. (You received this token from a previous call.)</p>
max_records: <p>The maximum number of items to return with this call. The default value is <code>100</code> and the maximum value is <code>100</code>.</p>
Raises:
capo_auto_scaling.errors.invalid_next_token.InvalidNextToken: <p>The <code>NextToken</code> value is not valid.</p>
capo_auto_scaling.errors.resource_contention_fault.ResourceContentionFault: <p>You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).</p>
capo_auto_scaling.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To describe the target groups for an Auto Scaling group
This example describes the target groups attached to the specified Auto Scaling group.
>>> await client.describe_load_balancer_target_groups(auto_scaling_group_name='my-auto-scaling-group')
"""
async def _handler(
req: "AsyncOperationRequest[capo_auto_scaling.types.describe_load_balancer_target_groups_request.DescribeLoadBalancerTargetGroupsRequest]",
) -> AsyncOperationResponse[
"capo_auto_scaling.types.describe_load_balancer_target_groups_response.DescribeLoadBalancerTargetGroupsResponse"
]:
import capo_auto_scaling._operations.auto_scaling_2011_01_01.describe_load_balancer_target_groups
(
output,
http_response,
) = await capo_auto_scaling._operations.auto_scaling_2011_01_01.describe_load_balancer_target_groups.async_describe_load_balancer_target_groups(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DescribeLoadBalancerTargetGroups")
)
input_: capo_auto_scaling.types.describe_load_balancer_target_groups_request.DescribeLoadBalancerTargetGroupsRequest = {}
if auto_scaling_group_name is not None:
input_["auto_scaling_group_name"] = auto_scaling_group_name
if next_token is not None:
input_["next_token"] = next_token
if max_records is not None:
input_["max_records"] = max_records
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|