Create a Capacity Reservation - Amazon Elastic Compute Cloud

Create a Capacity Reservation

You can create a Capacity Reservation to ensure that you have compute capacity available in a specific Availability Zone. If your request to create a Capacity Reservation succeeds, the capacity is available immediately. The capacity remains reserved for your use as long as the Capacity Reservation is active, and you can launch instances into it at any time. If the Capacity Reservation is open, new instances and existing instances that have matching attributes automatically run in the capacity of the Capacity Reservation. If the Capacity Reservation is targeted, instances must specifically target it to run in the reserved capacity.

Your request to create a Capacity Reservation could fail if one of the following is true:

  • Amazon EC2 does not have sufficient capacity to fulfill the request. Either try again at a later time, try a different Availability Zone, or try a smaller request. If your application is flexible across instance types and sizes, try different instance attributes.

  • The requested quantity exceeds your On-Demand Instance limit for the selected instance family. Increase your On-Demand Instance limit for the instance family and try again. For more information, see On-Demand Instance quotas.

To create a Capacity Reservation using the console
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. Choose Capacity Reservations, and then choose Create Capacity Reservation.

  3. On the Create a Capacity Reservation page, configure the following settings in the Instance details section. The instance type, platform, Availability Zone, and tenancy of the instances that you launch must match the instance type, platform, Availability Zone, and tenancy that you specify here or the Capacity Reservation is not applied. For example, if an open Capacity Reservation doesn't match, an instance launch that targets that Capacity Reservation explicitly will fail.

    1. Instance Type—The type of instance to launch into the reserved capacity.

    2. Launch EBS-optimized instances—Specify whether to reserve the capacity for EBS-optimized instances. This option is selected by default for some instance types. For more information, see Amazon EBS-optimized instance types.

    3. Platform—The operating system for your instances. For more information, see Supported platforms.

    4. Availability Zone—The Availability Zone in which to reserve the capacity.

    5. Tenancy—Specify whether to run on shared hardware (default) or a dedicated instance.

    6. (Optional) Placement group ARN —The ARN of the cluster placement group in which to create the Capacity Reservation.

      For more information, see Create Capacity Reservations in cluster placement groups.

    7. Quantity—The number of instances for which to reserve capacity. If you specify a quantity that exceeds your remaining On-Demand Instance limit for the selected instance type, the request is denied.

  4. Configure the following settings in the Reservation details section:

    1. Reservation Ends—Choose one of the following options:

      • Manually—Reserve the capacity until you explicitly cancel it.

      • Specific time—Cancel the capacity reservation automatically at the specified date and time.

    2. Instance eligibility—Choose one of the following options:

      • open—(Default) The Capacity Reservation matches any instance that has matching attributes (instance type, platform, Availability Zone, and tenancy). If you launch an instance with matching attributes, it is placed into the reserved capacity automatically.

      • targeted—The Capacity Reservation only accepts instances that have matching attributes (instance type, platform, Availability Zone, and tenancy), and that explicitly target the reservation.

  5. Choose Request reservation.

To create a Capacity Reservation using the AWS CLI

Use the create-capacity-reservation command. For more information, see Supported platforms.

The following command creates a Capacity Reservation that reserves capacity for three m5.2xlarge instances running Red Hat Enterprise Linux AMIs in the us-east-1a Availability Zone.

aws ec2 create-capacity-reservation --instance-type m5.2xlarge --instance-platform Red Hat Enterprise Linux --availability-zone us-east-1a --instance-count 3

The following command creates a Capacity Reservation that reserves capacity for three m5.2xlarge instances running Windows with SQL Server AMIs in the us-east-1a Availability Zone.

aws ec2 create-capacity-reservation --instance-type m5.2xlarge --instance-platform Windows with SQL Server --availability-zone us-east-1a --instance-count 3