Modifying a Subnet Attribute

You can modify an attribute of a subnet.

You can specify whether a public IP is assigned to the network interfaces created in the subnet, including the network interfaces created when launching an instance in a subnet.

This feature is not available from Cockpit. This documentation only describes the procedure using AWS CLI.

To modify a subnet attribute, use the modify-subnet-attribute command following this syntax:

Request sample
$ aws ec2 modify-subnet-attribute \
    --profile YOUR_PROFILE \
    --subnet-id subnet-12ab34cd \
    --map-public-ip-on-launch \
    --endpoint https://fcu.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • subnet-id: The ID of the subnet whose attribute you want to modify.

  • (optional) map-public-ip-on-launch | no-map-public-ip-on-launch: If set to map-public-ip-on-launch, a public IP is automatically assigned to the instance launched with this subnet. The public IP remains assigned to the instance, even when it is stopped, and is released when the instance is terminated.
    If set to no-map-public-ip-on-launch, no public IP is assigned.

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

The specified attribute is modified.

Related Pages

Corresponding API Method

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.