Enables the Availability Zones for the specified public subnets for the specified Application Load Balancer or Network Load Balancer. The specified subnets replace the previously enabled subnets.
When you specify subnets for a Network Load Balancer, you must include all subnets that were enabled previously, with their existing configurations, plus any additional subnets.
See also: AWS API Documentation
See ‘aws help’ for descriptions of global parameters.
set-subnets
--load-balancer-arn <value>
[--subnets <value>]
[--subnet-mappings <value>]
[--ip-address-type <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
--load-balancer-arn
(string)
The Amazon Resource Name (ARN) of the load balancer.
--subnets
(list)
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.
(string)
Syntax:
"string" "string" ...
--subnet-mappings
(list)
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 cannot 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.
(structure)
Information about a subnet mapping.
SubnetId -> (string)
The ID of the subnet.
AllocationId -> (string)
[Network Load Balancers] The allocation ID of the Elastic IP address for an internet-facing load balancer.
PrivateIPv4Address -> (string)
[Network Load Balancers] The private IPv4 address for an internal load balancer.
IPv6Address -> (string)
[Network Load Balancers] The IPv6 address.
Shorthand Syntax:
SubnetId=string,AllocationId=string,PrivateIPv4Address=string,IPv6Address=string ...
JSON Syntax:
[
{
"SubnetId": "string",
"AllocationId": "string",
"PrivateIPv4Address": "string",
"IPv6Address": "string"
}
...
]
--ip-address-type
(string)
[Network Load Balancers] The type of IP addresses used by the subnets for your load balancer. The possible values are
ipv4
(for IPv4 addresses) anddualstack
(for IPv4 and IPv6 addresses). You can’t specifydualstack
for a load balancer with a UDP or TCP_UDP listener. .Possible values:
ipv4
dualstack
--cli-input-json
| --cli-input-yaml
(string)
Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton
. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml
.
--generate-cli-skeleton
(string)
Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input
, prints a sample input JSON that can be used as an argument for --cli-input-json
. Similarly, if provided yaml-input
it will print a sample input YAML that can be used with --cli-input-yaml
. If provided with the value output
, it validates the command inputs and returns a sample output JSON for that command. The generated JSON skeleton is not stable between versions of the AWS CLI and there are no backwards compatibility guarantees in the JSON skeleton generated.
See ‘aws help’ for descriptions of global parameters.
Note
To use the following examples, you must have the AWS CLI installed and configured. See the Getting started guide in the AWS CLI User Guide for more information.
Unless otherwise stated, all examples have unix-like quotation rules. These examples will need to be adapted to your terminal’s quoting rules. See Using quotation marks with strings in the AWS CLI User Guide .
To enable Availability Zones for a load balancer
This example enables the Availability Zone for the specified subnet for the specified load balancer.
Command:
aws elbv2 set-subnets --load-balancer-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188 --subnets subnet-8360a9e7 subnet-b7d581c0
Output:
{
"AvailabilityZones": [
{
"SubnetId": "subnet-8360a9e7",
"ZoneName": "us-west-2a"
},
{
"SubnetId": "subnet-b7d581c0",
"ZoneName": "us-west-2b"
}
]
}
AvailabilityZones -> (list)
Information about the subnets.
(structure)
Information about an Availability Zone.
ZoneName -> (string)
The name of the Availability Zone.
SubnetId -> (string)
The ID of the subnet. You can specify one subnet per Availability Zone.
OutpostId -> (string)
[Application Load Balancers on Outposts] The ID of the Outpost.
LoadBalancerAddresses -> (list)
[Network Load Balancers] If you need static IP addresses for your load balancer, you can specify one Elastic IP address per Availability Zone when you create an internal-facing load balancer. For internal load balancers, you can specify a private IP address from the IPv4 range of the subnet.
(structure)
Information about a static IP address for a load balancer.
IpAddress -> (string)
The static IP address.
AllocationId -> (string)
[Network Load Balancers] The allocation ID of the Elastic IP address for an internal-facing load balancer.
PrivateIPv4Address -> (string)
[Network Load Balancers] The private IPv4 address for an internal load balancer.
IPv6Address -> (string)
[Network Load Balancers] The IPv6 address.
IpAddressType -> (string)
[Network Load Balancers] The IP address type.