[ aws . ec2 ]

modify-subnet-attribute

Description

Modifies a subnet attribute. You can only modify one attribute at a time.

See also: AWS API Documentation

See ‘aws help’ for descriptions of global parameters.

Synopsis

  modify-subnet-attribute
[--assign-ipv6-address-on-creation | --no-assign-ipv6-address-on-creation]
[--map-public-ip-on-launch | --no-map-public-ip-on-launch]
--subnet-id <value>
[--map-customer-owned-ip-on-launch | --no-map-customer-owned-ip-on-launch]
[--customer-owned-ipv4-pool <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]

Options

--assign-ipv6-address-on-creation | --no-assign-ipv6-address-on-creation (structure)

Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address. This includes a network interface that’s created when launching an instance into the subnet (the instance therefore receives an IPv6 address).

If you enable the IPv6 addressing feature for your subnet, your network interface or instance only receives an IPv6 address if it’s created using version 2016-11-15 or later of the Amazon EC2 API.

Value -> (boolean)

The attribute value. The valid values are true or false .

--map-public-ip-on-launch | --no-map-public-ip-on-launch (structure)

Specify true to indicate that network interfaces attached to instances created in the specified subnet should be assigned a public IPv4 address.

Value -> (boolean)

The attribute value. The valid values are true or false .

--subnet-id (string)

The ID of the subnet.

--map-customer-owned-ip-on-launch | --no-map-customer-owned-ip-on-launch (structure)

Specify true to indicate that network interfaces attached to instances created in the specified subnet should be assigned a customer-owned IPv4 address.

When this value is true , you must specify the customer-owned IP pool using CustomerOwnedIpv4Pool .

Value -> (boolean)

The attribute value. The valid values are true or false .

--customer-owned-ipv4-pool (string)

The customer-owned IPv4 address pool associated with the subnet.

You must set this value when you specify true for MapCustomerOwnedIpOnLaunch .

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

See ‘aws help’ for descriptions of global parameters.

Examples

To change a subnet’s public IPv4 addressing behavior

This example modifies subnet-1a2b3c4d to specify that all instances launched into this subnet are assigned a public IPv4 address. If the command succeeds, no output is returned.

Command:

aws ec2 modify-subnet-attribute --subnet-id subnet-1a2b3c4d --map-public-ip-on-launch

To change a subnet’s IPv6 addressing behavior

This example modifies subnet-1a2b3c4d to specify that all instances launched into this subnet are assigned an IPv6 address from the range of the subnet.

Command:

aws ec2 modify-subnet-attribute --subnet-id subnet-1a2b3c4d --assign-ipv6-address-on-creation

For more information, see IP Addressing in Your VPC in the AWS Virtual Private Cloud User Guide.

Output

None