Manage prefixes for your network interfaces - Amazon Elastic Compute Cloud

Manage prefixes for your network interfaces

You can manage the prefixes with your network interfaces as follows.

Assign prefixes during network interface creation

You can assign automatic or custom prefixes when you create a network interface.

Console
To assign automatic prefixes during network interface creation
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, choose Network Interfaces.

  3. Choose Create network interface.

  4. Enter a description for the network interface, select the subnet in which to create the network interface, and configure the private IPv4 and IPv6 addresses.

  5. Expand Advanced settings.

  6. For IPv4 prefix delegation do one of the following:

    • To automatically assign an IPv4 prefix, choose Auto-assign. For Number of IPv4 prefixes, enter the number of prefixes to assign.

    • To assign a specific IPv4 prefix, choose Custom. Choose Add new prefix and enter the prefix.

  7. For IPv4 prefix delegation do one of the following:

    • To automatically assign an IPv6 prefix, choose Auto-assign. For Number of IPv6 prefixes, enter the number of prefixes to assign.

    • To assign a specific IPv6 prefix, choose Custom. Choose Add new prefix and enter the prefix.

    Note

    IPv6 prefix delegation appears only if the selected subnet is enabled for IPv6.

  8. Select the security groups to associate with the network interface and assign resource tags if needed.

  9. Choose Create network interface.

AWS CLI
To assign automatic IPv4 prefixes during network interface creation

Use the create-network-interface command and set --ipv4-prefix-count to the number of prefixes that you want AWS to assign. In the following example, AWS assigns one prefix.

$ C:\> aws ec2 create-network-interface \ --subnet-id subnet-047cfed18eEXAMPLE \ --description "IPv4 automatic example" \ --ipv4-prefix-count 1
To assign specific IPv4 prefixes during network interface creation

Use the create-network-interface command and set --ipv4-prefixes to the prefixes. AWS selects IP addresses from this range. In the following example, the prefix CIDR is 10.0.0.208/28.

$ C:\> aws ec2 create-network-interface \ --subnet-id subnet-047cfed18eEXAMPLE \ --description "IPv4 manual example" \ --ipv4-prefixes Ipv4Prefix=10.0.0.208/28
To assign automatic IPv6 prefixes during network interface creation

Use the create-network-interface command and set --ipv6-prefix-count to the number of prefixes that you want AWS to assign. In the following example, AWS assigns one prefix.

$ C:\> aws ec2 create-network-interface \ --subnet-id subnet-047cfed18eEXAMPLE \ --description "IPv6 automatic example" \ --ipv6-prefix-count 1
To assign specific IPv6 prefixes during network interface creation

Use the create-network-interface command and set --ipv6-prefixes to the prefixes. AWS selects IP addresses from this range. In the following example, the prefix CIDR is 2600:1f13:fc2:a700:1768::/80.

$ C:\> aws ec2 create-network-interface \ --subnet-id subnet-047cfed18eEXAMPLE \ --description "IPv6 manual example" \ --ipv6-prefixes Ipv6Prefix=2600:1f13:fc2:a700:1768::/80

Assign prefixes to an existing network interface

You can assign automatic or custom prefixes to an existing network interface.

Console
To assign automatic prefixes to an existing network interface
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, choose Network Interfaces.

  3. Select the network interface to which to assign the prefixes, and choose Actions, Manage prefixes.

  4. For IPv4 prefix delegation do one of the following:

    • To automatically assign an IPv4 prefix, choose Auto-assign. For Number of IPv4 prefixes, enter the number of prefixes to assign.

    • To assign a specific IPv4 prefix, choose Custom. Choose Add new prefix and enter the prefix.

  5. For IPv6 prefix delegation do one of the following:

    • To automatically assign an IPv6 prefix, choose Auto-assign. For Number of IPv6 prefixes, enter the number of prefixes to assign.

    • To assign a specific IPv6 prefix, choose Custom. Choose Add new prefix and enter the prefix.

    Note

    IPv6 prefix delegation appears only if the selected subnet is enabled for IPv6.

  6. Choose Save.

AWS CLI

You can use the assign-ipv6-addresses command to assign IPv6 prefixes and the assign-private-ip-addresses command to assign IPv4 prefixes to existing network interfaces.

To assign automatic IPv4 prefixes to an existing network interface

Use the assign-private-ip-addresses command and set --ipv4-prefix-count to the number of prefixes that you want AWS to assign. In the following example, AWS assigns one IPv4 prefix.

aws ec2 assign-private-ip-addresses \ --network-interface-id eni-081fbb4095EXAMPLE \ --ipv4-prefix-count 1
To assign specific IPv4 prefixes to an existing network interface

Use the assign-private-ip-addresses command and set --ipv4-prefixes to the prefix. AWS selects IPv4 addresses from this range. In the following example, the prefix CIDR is 10.0.0.208/28.

aws ec2 assign-private-ip-addresses \ --network-interface-id eni-081fbb4095EXAMPLE \ --ipv4-prefixes 10.0.0.208/28
To assign automatic IPv6 prefixes to an existing network interface

Use the assign-ipv6-addresses command and set --ipv6-prefix-count to the number of prefixes that you want AWS to assign. In the following example, AWS assigns one IPv6 prefix.

aws ec2 assign-ipv6-addresses \ --network-interface-id eni-00d577338cEXAMPLE \ --ipv6-prefix-count 1
To assign specific IPv6 prefixes to an existing network interface

Use the assign-ipv6-addresses command and set --ipv6-prefixes to the prefix. AWS selects IPv6 addresses from this range. In the following example, the prefix CIDR is 2600:1f13:fc2:a700:18bb::/80.

aws ec2 assign-ipv6-addresses \ --network-interface-id eni-00d577338cEXAMPLE \ --ipv6-prefixes 2600:1f13:fc2:a700:18bb::/80

Remove prefixes from your network interfaces

You can remove prefixes from an existing network interface.

Console
To remove the prefixes from a network interface
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the navigation pane, choose Network Interfaces.

  3. Select the network interface.

  4. Choose Actions, Manage prefixes.

  5. For IPv4 prefix delegation, to remove specific prefixes, choose Unassign next to the prefixes to remove. To remove all prefixes, choose Do not assign.

  6. For IPv6 prefix delegation, to remove specific prefixes, choose Unassign next to the prefixes to remove. To remove all prefixes, choose Do not assign.

    Note

    IPv6 prefix delegation appears only if the selected subnet is enabled for IPv6.

  7. Choose Save.

AWS CLI

You can use the unassign-ipv6-addresses command to remove IPv6 prefixes and the unassign-private-ip-addresses commands to remove IPv4 prefixes from your existing network interfaces.

To remove IPv4 prefixes from a network interface

Use the unassign-private-ip-addresses command and set --ipv4-prefix to the address that you want to remove.

aws ec2 unassign-private-ip-addresses \ --network-interface-id eni-081fbb4095EXAMPLE \ --ipv4-prefixes 10.0.0.176/28
To remove IPv6 prefixes from a network interface

Use the unassign-ipv6-addresses command and set --ipv6-prefix to the address that you want to remove.

aws ec2 unassign-ipv6-addresses \ --network-interface-id eni-00d577338cEXAMPLE \ --ipv6-prefix 2600:1f13:fc2:a700:18bb::/80