Subnet CIDR reservations - Amazon Virtual Private Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Subnet CIDR reservations

A subnet CIDR reservation is a range of IPv4 or IPv6 addresses that you set aside so that Amazon can't assign them to your network interfaces. This enables you to reserve IPv4 or IPv6 CIDR blocks (also called "prefixes") for use with your network interfaces.

When you create a subnet CIDR reservation, you specify how you will use the reserved IP addresses. The following options are available:

  • Prefix — Amazon assigns addresses from the reserved IP address range to network interfaces. For more information, see Assign prefixes to Amazon EC2 network interfaces in the Amazon EC2 User Guide for Linux Instances.

  • Explicit — You manually assign IP addresses to network interfaces.

The following rules apply to subnet CIDR reservations:

  • When you create a subnet CIDR reservation, the IP address range can include addresses that are already in use. Creating a subnet reservation does not unassign any IP addresses that are already in use.

  • You can reserve multiple CIDR ranges per subnet. When you reserve multiple CIDR ranges within the same VPC, the CIDR ranges cannot overlap.

  • When you reserve more than one range in a subnet for Prefix Delegation, and Prefix Delegation is configured for automatic assignment, we choose the IP addresses to assign to network interfaces at random.

  • When you delete a subnet reservation, the unused IP addresses are available for Amazon to assign to your network interfaces. Deleting a subnet reservation does not unassign any IP addresses that are in use.

For more information about Classless Inter-Domain Routing (CIDR) notation, see IP addressing for your VPCs and subnets.

Work with subnet CIDR reservations using the console

You can create and manage subnet CIDR reservations as follows.

To edit subnet CIDR reservations
  1. Open the Amazon VPC console at https://console.amazonaws.cn/vpc/.

  2. In the navigation pane, choose Subnets.

  3. Select the subnet.

  4. Choose the CIDR reservations tab to get information about any existing subnet CIDR reservations.

  5. To add or remove subnet CIDR reservations, choose Actions, Edit CIDR reservations and then do the following:

    • To add an IPv4 CIDR reservation, choose IPv4, Add IPv4 CIDR reservation. Choose the reservation type, enter the CIDR range, and choose Add.

    • To add an IPv6 CIDR reservation, choose IPv6, Add IPv6 CIDR reservation. Choose the reservation type, enter the CIDR range, and choose Add.

    • To remove a CIDR reservation, choose Remove for the subnet CIDR reservation.

Work with subnet CIDR reservations using the Amazon CLI

You can use the Amazon CLI to create and manage subnet CIDR reservations.

Create a subnet CIDR reservation

You can use create-subnet-cidr-reservation to create a subnet CIDR reservation.

aws ec2 create-subnet-cidr-reservation --subnet-id subnet-03c51e2eEXAMPLE --reservation-type prefix --cidr 2600:1f13:925:d240:3a1b::/80

The following is example output.

{ "SubnetCidrReservation": { "SubnetCidrReservationId": "scr-044f977c4eEXAMPLE", "SubnetId": "subnet-03c51e2ef5EXAMPLE", "Cidr": "2600:1f13:925:d240:3a1b::/80", "ReservationType": "prefix", "OwnerId": "123456789012" } }

View subnet CIDR reservations

You can use get-subnet-cidr-reservations to view the details of a subnet CIDR reservation.

aws ec2 get-subnet-cidr-reservations --subnet-id subnet-05eef9fb78EXAMPLE

Delete a subnet CIDR reservation

You can use delete-subnet-cidr-reservation to delete a subnet CIDR reservation.

aws ec2 delete-subnet-cidr-reservation --subnet-cidr-reservation-id scr-044f977c4eEXAMPLE