ElasticLoadBalancing / Client / enable_availability_zones_for_load_balancer

enable_availability_zones_for_load_balancer#

ElasticLoadBalancing.Client.enable_availability_zones_for_load_balancer(**kwargs)#

Adds the specified Availability Zones to the set of Availability Zones for the specified load balancer in EC2-Classic or a default VPC.

For load balancers in a non-default VPC, use AttachLoadBalancerToSubnets.

The load balancer evenly distributes requests across all its registered Availability Zones that contain instances. For more information, see Add or Remove Availability Zones in the Classic Load Balancers Guide.

See also: AWS API Documentation

Request Syntax

response = client.enable_availability_zones_for_load_balancer(
    LoadBalancerName='string',
    AvailabilityZones=[
        'string',
    ]
)
Parameters:
  • LoadBalancerName (string) –

    [REQUIRED]

    The name of the load balancer.

  • AvailabilityZones (list) –

    [REQUIRED]

    The Availability Zones. These must be in the same region as the load balancer.

    • (string) –

Return type:

dict

Returns:

Response Syntax

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

Response Structure

  • (dict) –

    Contains the output of EnableAvailabilityZonesForLoadBalancer.

    • AvailabilityZones (list) –

      The updated list of Availability Zones for the load balancer.

      • (string) –

Exceptions

  • ElasticLoadBalancing.Client.exceptions.AccessPointNotFoundException

Examples

This example adds the specified Availability Zone to the specified load balancer.

response = client.enable_availability_zones_for_load_balancer(
    AvailabilityZones=[
        'us-west-2b',
    ],
    LoadBalancerName='my-load-balancer',
)

print(response)

Expected Output:

{
    'AvailabilityZones': [
        'us-west-2a',
        'us-west-2b',
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}