Deregisters the specified targets from the specified target group. After the targets are deregistered, they no longer receive traffic from the load balancer.
The load balancer stops sending requests to targets that are deregistering, but uses connection draining to ensure that in-flight traffic completes on the existing connections. This deregistration delay is configured by default but can be updated for each target group.
For more information, see the following:
Note: If the specified target does not exist, the action returns successfully.
Parameters:
-
target_group_arn
(Optional[TargetGroupArn], default:
None
)
–
The Amazon Resource Name (ARN) of the target group.
-
targets
(Optional[TargetDescriptions], default:
None
)
–
The targets. If you specified a port override when you registered a target, you must specify both the target ID and the port when you deregister it.
Raises:
Examples:
To deregister a target from a target group
This example deregisters the specified instance from the specified target group.
>>> await client.deregister_targets(target_group_arn='arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067', targets=[{'Id': 'i-0f76fade'}])
Source code in docs_src/capo_elastic_load_balancing_v2/_services/async_elastic_load_balancingv2.py
| async def deregister_targets(
self,
*,
config_overrides: Optional[AsyncElasticLoadBalancingv2ClientConfig] = None,
target_group_arn: Optional[
"capo_elastic_load_balancing_v2.types.target_group_arn.TargetGroupArn"
] = None,
targets: Optional[
"capo_elastic_load_balancing_v2.types.target_descriptions.TargetDescriptions"
] = None,
) -> "capo_elastic_load_balancing_v2.types.deregister_targets_output.DeregisterTargetsOutput":
"""<p>Deregisters the specified targets from the specified target group. After the targets are deregistered, they no longer receive traffic from the load balancer.</p> <p>The load balancer stops sending requests to targets that are deregistering, but uses connection draining to ensure that in-flight traffic completes on the existing connections. This deregistration delay is configured by default but can be updated for each target group.</p> <p>For more information, see the following:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/application/edit-target-group-attributes.html#deregistration-delay"> Deregistration delay</a> in the <i>Application Load Balancers User Guide</i> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/network/edit-target-group-attributes.html#deregistration-delay"> Deregistration delay</a> in the <i>Network Load Balancers User Guide</i> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/gateway/edit-target-group-attributes.html#deregistration-delay"> Deregistration delay</a> in the <i>Gateway Load Balancers User Guide</i> </p> </li> </ul> <p>Note: If the specified target does not exist, the action returns successfully.</p>
Args:
target_group_arn: <p>The Amazon Resource Name (ARN) of the target group.</p>
targets: <p>The targets. If you specified a port override when you registered a target, you must specify both the target ID and the port when you deregister it.</p>
Raises:
capo_elastic_load_balancing_v2.errors.invalid_target_exception.InvalidTargetException: <p>The specified target does not exist, is not in the same VPC as the target group, or has an unsupported instance type.</p>
capo_elastic_load_balancing_v2.errors.target_group_not_found_exception.TargetGroupNotFoundException: <p>The specified target group does not exist.</p>
capo_elastic_load_balancing_v2.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To deregister a target from a target group
This example deregisters the specified instance from the specified target group.
>>> await client.deregister_targets(target_group_arn='arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067', targets=[{'Id': 'i-0f76fade'}])
"""
async def _handler(
req: "AsyncOperationRequest[capo_elastic_load_balancing_v2.types.deregister_targets_input.DeregisterTargetsInput]",
) -> AsyncOperationResponse[
"capo_elastic_load_balancing_v2.types.deregister_targets_output.DeregisterTargetsOutput"
]:
import capo_elastic_load_balancing_v2._operations.elastic_load_balancing_v10.deregister_targets
(
output,
http_response,
) = await capo_elastic_load_balancing_v2._operations.elastic_load_balancing_v10.deregister_targets.async_deregister_targets(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeregisterTargets")
)
input_: capo_elastic_load_balancing_v2.types.deregister_targets_input.DeregisterTargetsInput = {}
if target_group_arn is not None:
input_["target_group_arn"] = target_group_arn
if targets is not None:
input_["targets"] = targets
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|