set_subnets
async
¶
set_subnets(
*,
config_overrides: Optional[AsyncElasticLoadBalancingv2ClientConfig] = None,
load_balancer_arn: Optional[LoadBalancerArn] = None,
subnets: Optional[Subnets] = None,
subnet_mappings: Optional[SubnetMappings] = None,
ip_address_type: Optional[IpAddressType] = None,
enable_prefix_for_ipv6_source_nat: Optional[
EnablePrefixForIpv6SourceNatEnum
] = None,
) -> SetSubnetsOutput
Enables the Availability Zones for the specified public subnets for the specified Application Load Balancer, Network Load Balancer or Gateway Load Balancer. The specified subnets replace the previously enabled subnets.
Parameters:
-
load_balancer_arn(Optional[LoadBalancerArn], default:None) –The Amazon Resource Name (ARN) of the load balancer.
-
subnets(Optional[Subnets], default:None) –The IDs of the public subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings.
[Application Load Balancers] You must specify subnets from at least two Availability Zones.
[Application Load Balancers on Outposts] You must specify one Outpost subnet.
[Application Load Balancers on Local Zones] You can specify subnets from one or more Local Zones.
[Network Load Balancers] You can specify subnets from one or more Availability Zones.
[Gateway Load Balancers] You can specify subnets from one or more Availability Zones. You must include all subnets that were enabled previously, with their existing configurations, plus any additional subnets.
-
subnet_mappings(Optional[SubnetMappings], default:None) –The IDs of the public subnets. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings.
[Application Load Balancers] You must specify subnets from at least two Availability Zones. You can't specify Elastic IP addresses for your subnets.
[Application Load Balancers on Outposts] You must specify one Outpost subnet.
[Application Load Balancers on Local Zones] You can specify subnets from one or more Local Zones.
[Network Load Balancers] You can specify subnets from one or more Availability Zones. You can specify one Elastic IP address per subnet if you need static IP addresses for your internet-facing load balancer. For internal load balancers, you can specify one private IP address per subnet from the IPv4 range of the subnet. For internet-facing load balancer, you can specify one IPv6 address per subnet.
[Gateway Load Balancers] You can specify subnets from one or more Availability Zones.
-
ip_address_type(Optional[IpAddressType], default:None) –The IP address type.
[Application Load Balancers] The possible values are
ipv4(IPv4 addresses),dualstack(IPv4 and IPv6 addresses), anddualstack-without-public-ipv4(public IPv6 addresses and private IPv4 and IPv6 addresses).[Network Load Balancers and Gateway Load Balancers] The possible values are
ipv4(IPv4 addresses) anddualstack(IPv4 and IPv6 addresses). -
enable_prefix_for_ipv6_source_nat(Optional[EnablePrefixForIpv6SourceNatEnum], default:None) –[Network Load Balancers with UDP listeners] Indicates whether to use an IPv6 prefix from each subnet for source NAT. The IP address type must be
dualstack. The default value isoff.
Raises:
-
AllocationIdNotFoundException–The specified allocation ID does not exist.
-
AvailabilityZoneNotSupportedException–The specified Availability Zone is not supported.
-
CapacityReservationPendingException–There is a pending capacity reservation.
-
InvalidConfigurationRequestException–The requested configuration is not valid.
-
InvalidSubnetException–The specified subnet is out of available addresses.
-
LoadBalancerNotFoundException–The specified load balancer does not exist.
-
SubnetNotFoundException–The specified subnet does not exist.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To enable Availability Zones for a load balancer This example enables the Availability Zones for the specified subnets for the specified load balancer.
>>> await client.set_subnets(load_balancer_arn='arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188', subnets=['subnet-8360a9e7', 'subnet-b7d581c0'])
Source code in docs_src/capo_elastic_load_balancing_v2/_services/async_elastic_load_balancingv2.py
4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 | |