Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

Note: You are viewing the documentation for an older major version of the AWS CLI (version 1).

AWS CLI version 2, the latest major version of AWS CLI, is now stable and recommended for general use. To view this page for the AWS CLI version 2, click here. For more information see the AWS CLI version 2 installation instructions and migration guide.

[ aws . elbv2 ]

set-subnets

Description

Enables the Availability Zones for the specified public subnets for the specified 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.

Synopsis

  set-subnets
--load-balancer-arn <value>
[--subnets <value>]
[--subnet-mappings <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--load-balancer-arn (string)

The Amazon Resource Name (ARN) of the load balancer.

--subnets (list)

The IDs of the public subnets. You must specify subnets from at least two Availability Zones. You can specify only one subnet per Availability Zone. You must specify either subnets or subnet mappings.

(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.

[Network Load Balancers] You can specify subnets from one or more Availability Zones. If you need static IP addresses for your internet-facing load balancer, you can specify one Elastic IP address per subnet. For internal load balancers, you can specify one private IP address per subnet from the IPv4 range of the 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.

Shorthand Syntax:

SubnetId=string,AllocationId=string,PrivateIPv4Address=string ...

JSON Syntax:

[
  {
    "SubnetId": "string",
    "AllocationId": "string",
    "PrivateIPv4Address": "string"
  }
  ...
]

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI 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.

--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. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

See 'aws help' for descriptions of global parameters.

Examples

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"
      }
  ]
}

Output

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.