Lab9b : Configure your subnets
To view subnet details using the console
- Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.
- In the navigation pane, choose Subnets.
- Select the checkbox for the subnet or choose the subnet ID to open the detail page.
To describe a subnet using the AWS CLI
Use the describe-subnets command.
To view your subnets across all Regions
Open the Amazon EC2 Global View console at https://console.aws.amazon.com/ec2globalview/home. For more information, see List and filter resources using the Amazon EC2 Global View in the Amazon EC2 User Guide for Linux Instances.
Add an IPv6 CIDR block to your subnet
To add an IPv6 CIDR block to a subnet
- Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.
- In the navigation pane, choose Subnets.
- Select your subnet and choose Actions, Edit IPv6 CIDRs.
- Choose Add IPv6 CIDR.
- Choose a VPC CIDR block, enter a Subnet CIDR block, and choose a netmask length that’s equal to or more specific than the netmask length of the VPC CIDR. For example, if the VPC pool CIDR is /50, you can choose a netmask length between /50 to /64 for the subnet. Possible IPv6 netmask lengths are between /44 and /64 in increments of /4.
- Choose Save.
To associate an IPv6 CIDR block with a subnet using the AWS CLI
Use the associate-subnet-cidr-block command.
Remove an IPv6 CIDR block from your subnet
Before you can remove an IPv6 CIDR block, you must first unassign any IPv6 addresses that are assigned to any instances in your subnet.
To remove an IPv6 CIDR block from a subnet
- Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.
- In the navigation pane, choose Subnets.
- Select the subnet and choose Actions, Edit IPv6 CIDRs.
- Find the IPv6 CIDR block and choose Remove.
- Choose Save.
To disassociate an IPv6 CIDR block from a subnet using the AWS CLI
Use the disassociate-subnet-cidr-block command.
Modify the public IPv4 addressing attribute for your subnet
false
, and default subnets have this attribute set to true
. An exception is a nondefault subnet created by the Amazon EC2 launch instance wizard — the wizard sets the attribute to true
. You can modify this attribute using the Amazon VPC console.To modify your subnet’s public IPv4 addressing behavior
- Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.
- In the navigation pane, choose Subnets.
- Select your subnet and choose Actions, Edit subnet settings.
- The Enable auto-assign public IPv4 address check box, if selected, requests a public IPv4 address for all instances launched into the selected subnet. Select or clear the check box as required, and then choose Save.
To modify a subnet attribute using the AWS CLI
Use the modify-subnet-attribute command.
Modify the IPv6 addressing attribute for your subnet
false
. You can modify this attribute using the Amazon VPC console. If you enable the IPv6 addressing attribute for your subnet, network interfaces created in the subnet receive an IPv6 address from the range of the subnet. Instances launched into the subnet receive an IPv6 address on the primary network interface.Your subnet must have an associated IPv6 CIDR block.
Note
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. The Amazon EC2 console uses the latest API version.
To modify your subnet’s IPv6 addressing behavior
- Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.
- In the navigation pane, choose Subnets.
- Select your subnet and choose Actions, Edit subnet settings.
- The Enable auto-assign IPv6 address check box, if selected, requests an IPv6 address for all network interfaces created in the selected subnet. Select or clear the check box as required, and then choose Save.
To modify a subnet attribute using the AWS CLI
Use the modify-subnet-attribute command.