Manage the IPv6 addresses for your EC2 instances - Amazon Elastic Compute Cloud

Manage the IPv6 addresses for your EC2 instances

If your VPC and subnet have IPv6 CIDR blocks associated with them, you can assign an IPv6 address to your instance during or after launch. You can view the IPv6 addresses for your instances in the console on either the Instances page or the Network Interfaces page.

Assign an IPv6 address to an instance

You can specify an IPv6 address from the IPv6 address range of the subnet, or let Amazon choose one for you. This address is assigned to the primary network interface. Note that the following instance types do not support IPv6 addresses: C1, M1, M2, M3, and T1.

To assign an IPv6 address during instance launch

Follow the procedure to launch an instance. When you configure Network Settings, choose the option to Auto-assign IPv6 IP.

To assign an IPv6 address after launch
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, choose Instances.

  3. Select your instance, and choose Actions, Networking, Manage IP addresses.

  4. Expand the network interface. Under IPv6 addresses, choose Assign new IP address. Enter an IPv6 address from the range of the subnet or leave the field blank to let Amazon choose one for you.

  5. Choose Save.

To assign an IPv6 address using the command line

You can use one of the following commands. For more information about these command line interfaces, see Access Amazon EC2.

View the IPv6 addresses

You can use the Amazon EC2 console, AWS CLI, and instance metadata to view the IPv6 addresses for your instances.

To view the IPv6 addresses for an instance using the console
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, choose Instances.

  3. Select the instance.

  4. On the Networking tab, locate IPv6 addresses.

To view the IPv6 addresses for an instance using the command line

You can use one of the following commands. For more information about these command line interfaces, see Access Amazon EC2.

To view the IPv6 addresses for an instance using instance metadata
  1. Connect to your instance. For more information, see Connect to your EC2 instance.

  2. Get the MAC address of the instance from http://169.254.169.254/latest/meta-data/network/interfaces/macs/.

  3. Use the following command to view the IPv6 address.

    IMDSv2
    [ec2-user ~]$ TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \ && curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/network/interfaces/macs/mac-address/ipv6s
    IMDSv1
    [ec2-user ~]$ curl http://169.254.169.254/latest/meta-data/network/interfaces/macs/mac-address/ipv6s
    Tools for Windows PowerShell
    PS C:\> Invoke-RestMethod http://169.254.169.254/latest/meta-data/network/interfaces/macs/mac-address/ipv6s

Unassign an IPv6 address from an instance

You can unassign an IPv6 address from an instance at any time.

To unassign an IPv6 address from an instance using the console
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, choose Instances.

  3. Select your instance, and choose Actions, Networking, Manage IP addresses.

  4. Expand the network interface. Under IPv6 addresses, choose Unassign next to the IPv6 address.

  5. Choose Save.

To unassign an IPv6 address from an instance using the command line

You can use one of the following commands. For more information about these command line interfaces, see Access Amazon EC2.