attach_load_balancer_to_subnets

attach_load_balancer_to_subnets(**kwargs)

Adds one or more subnets to the set of configured subnets for the specified load balancer.

The load balancer evenly distributes requests across all registered subnets. For more information, see Add or Remove Subnets for Your Load Balancer in a VPC in the Classic Load Balancers Guide .

See also: AWS API Documentation

Request Syntax

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

    [REQUIRED]

    The name of the load balancer.

  • Subnets (list) --

    [REQUIRED]

    The IDs of the subnets to add. You can add only one subnet per Availability Zone.

    • (string) --
Return type

dict

Returns

Response Syntax

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

Response Structure

  • (dict) --

    Contains the output of AttachLoadBalancerToSubnets.

    • Subnets (list) --

      The IDs of the subnets attached to the load balancer.

      • (string) --

Exceptions

  • ElasticLoadBalancing.Client.exceptions.AccessPointNotFoundException
  • ElasticLoadBalancing.Client.exceptions.InvalidConfigurationRequestException
  • ElasticLoadBalancing.Client.exceptions.SubnetNotFoundException
  • ElasticLoadBalancing.Client.exceptions.InvalidSubnetException

Examples

This example adds the specified subnet to the set of configured subnets for the specified load balancer.

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

print(response)

Expected Output:

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