detach_load_balancer_from_subnets

detach_load_balancer_from_subnets(**kwargs)

Removes the specified subnets from the set of configured subnets for the load balancer.

After a subnet is removed, all EC2 instances registered with the load balancer in the removed subnet go into the OutOfService state. Then, the load balancer balances the traffic among the remaining routable subnets.

See also: AWS API Documentation

Request Syntax

response = client.detach_load_balancer_from_subnets(
    LoadBalancerName='string',
    Subnets=[
        'string',
    ]
)
Parameters
  • LoadBalancerName (string) --

    [REQUIRED]

    The name of the load balancer.

  • Subnets (list) --

    [REQUIRED]

    The IDs of the subnets.

    • (string) --
Return type

dict

Returns

Response Syntax

{
    'Subnets': [
        'string',
    ]
}

Response Structure

  • (dict) --

    Contains the output of DetachLoadBalancerFromSubnets.

    • Subnets (list) --

      The IDs of the remaining subnets for the load balancer.

      • (string) --

Exceptions

  • ElasticLoadBalancing.Client.exceptions.AccessPointNotFoundException
  • ElasticLoadBalancing.Client.exceptions.InvalidConfigurationRequestException

Examples

This example detaches the specified load balancer from the specified subnet.

response = client.detach_load_balancer_from_subnets(
    LoadBalancerName='my-load-balancer',
    Subnets=[
        'subnet-0ecac448',
    ],
)

print(response)

Expected Output:

{
    'Subnets': [
        'subnet-15aaab61',
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}