Deregisters the specified instances from the specified load balancer. After the instance is deregistered, it no longer receives traffic from the load balancer.
You can use DescribeLoadBalancers to verify that the instance is deregistered from the load balancer.
For more information, see Register or De-Register EC2 Instances in the Classic Load Balancers Guide.
Parameters:
Raises:
Examples:
To deregister instances from a load balancer
This example deregisters the specified instance from the specified load balancer.
>>> client.deregister_instances_from_load_balancer(load_balancer_name='my-load-balancer', instances=[{'InstanceId': 'i-d6f6fae3'}])
Source code in docs_src/capo_elastic_load_balancing/_services/elastic_load_balancing.py
| def deregister_instances_from_load_balancer(
self,
load_balancer_name: "capo_elastic_load_balancing.types.access_point_name.AccessPointName",
instances: "capo_elastic_load_balancing.types.instances.Instances",
*,
config_overrides: Optional[ElasticLoadBalancingClientConfig] = None,
) -> "capo_elastic_load_balancing.types.deregister_end_points_output.DeregisterEndPointsOutput":
"""<p>Deregisters the specified instances from the specified load balancer. After the instance is deregistered, it no longer receives traffic from the load balancer.</p> <p>You can use <a>DescribeLoadBalancers</a> to verify that the instance is deregistered from the load balancer.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-deregister-register-instances.html">Register or De-Register EC2 Instances</a> in the <i>Classic Load Balancers Guide</i>.</p>
Args:
load_balancer_name: <p>The name of the load balancer.</p>
instances: <p>The IDs of the instances.</p>
Raises:
capo_elastic_load_balancing.errors.access_point_not_found_exception.AccessPointNotFoundException: <p>The specified load balancer does not exist.</p>
capo_elastic_load_balancing.errors.invalid_end_point_exception.InvalidEndPointException: <p>The specified endpoint is not valid.</p>
capo_elastic_load_balancing.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To deregister instances from a load balancer
This example deregisters the specified instance from the specified load balancer.
>>> client.deregister_instances_from_load_balancer(load_balancer_name='my-load-balancer', instances=[{'InstanceId': 'i-d6f6fae3'}])
"""
def _handler(
req: "OperationRequest[capo_elastic_load_balancing.types.deregister_end_points_input.DeregisterEndPointsInput]",
) -> OperationResponse[
"capo_elastic_load_balancing.types.deregister_end_points_output.DeregisterEndPointsOutput"
]:
import capo_elastic_load_balancing._operations.elastic_load_balancing_v7.deregister_instances_from_load_balancer
output, http_response = (
capo_elastic_load_balancing._operations.elastic_load_balancing_v7.deregister_instances_from_load_balancer.deregister_instances_from_load_balancer(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeregisterInstancesFromLoadBalancer")
)
input_: capo_elastic_load_balancing.types.deregister_end_points_input.DeregisterEndPointsInput = {
"load_balancer_name": load_balancer_name,
"instances": instances,
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|