HEX
Server: Apache
System: Linux vps-cdc32557.vps.ovh.ca 5.15.0-156-generic #166-Ubuntu SMP Sat Aug 9 00:02:46 UTC 2025 x86_64
User: hanode (1017)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //lib/python3/dist-packages/awscli/examples/ec2/create-capacity-reservation.rst
**Example 1: To create a Capacity Reservation**

The following ``create-capacity-reservation`` example creates a capacity reservation in the ``eu-west-1a`` Availability Zone, into which you can launch three ``t2.medium`` instances running a Linux/Unix operating system. By default, the capacity reservation is created with open instance matching criteria and no support for ephemeral storage, and it remains active until you manually cancel it. ::

    aws ec2 create-capacity-reservation \
        --availability-zone eu-west-1a \
        --instance-type t2.medium \
        --instance-platform Linux/UNIX \
        --instance-count 3

Output::

    {
        "CapacityReservation": {
            "CapacityReservationId": "cr-1234abcd56EXAMPLE ",
            "EndDateType": "unlimited",
            "AvailabilityZone": "eu-west-1a",
            "InstanceMatchCriteria": "open",
            "EphemeralStorage": false,
            "CreateDate": "2019-08-16T09:27:35.000Z",
            "AvailableInstanceCount": 3,
            "InstancePlatform": "Linux/UNIX",
            "TotalInstanceCount": 3,
            "State": "active",
            "Tenancy": "default",
            "EbsOptimized": false,
            "InstanceType": "t2.medium"
        }
    }

**Example 2: To create a Capacity Reservation that automatically ends at a specified date/time**

The following ``create-capacity-reservation`` example creates a capacity reservation in the ``eu-west-1a`` Availability Zone, into which you can launch three ``m5.large`` instances running a Linux/Unix operating system. This capacity reservation automatically ends on 08/31/2019 at 23:59:59. ::

    aws ec2 create-capacity-reservation \
        --availability-zone eu-west-1a \
        --instance-type m5.large \
        --instance-platform Linux/UNIX \
        --instance-count 3 \
        --end-date-type limited \
        --end-date 2019-08-31T23:59:59Z

Output::

    {
        "CapacityReservation": {
            "CapacityReservationId": "cr-1234abcd56EXAMPLE ",
            "EndDateType": "limited",
            "AvailabilityZone": "eu-west-1a",
            "EndDate": "2019-08-31T23:59:59.000Z",
            "InstanceMatchCriteria": "open",
            "EphemeralStorage": false,
            "CreateDate": "2019-08-16T10:15:53.000Z",
            "AvailableInstanceCount": 3,
            "InstancePlatform": "Linux/UNIX",
            "TotalInstanceCount": 3,
            "State": "active",
            "Tenancy": "default",
            "EbsOptimized": false,
            "InstanceType": "m5.large"
        }
    }

**Example 3: To create a Capacity Reservation that accepts only targeted instance launches**

The following ``create-capacity-reservation`` example creates a capacity reservation that accepts only targeted instance launches. ::

    aws ec2 create-capacity-reservation \
        --availability-zone eu-west-1a \
        --instance-type m5.large \
        --instance-platform Linux/UNIX \
        --instance-count 3 \
        --instance-match-criteria targeted

Output::

    {
        "CapacityReservation": {
            "CapacityReservationId": "cr-1234abcd56EXAMPLE ",
            "EndDateType": "unlimited",
            "AvailabilityZone": "eu-west-1a",
            "InstanceMatchCriteria": "targeted",
            "EphemeralStorage": false,
            "CreateDate": "2019-08-16T10:21:57.000Z",
            "AvailableInstanceCount": 3,
            "InstancePlatform": "Linux/UNIX",
            "TotalInstanceCount": 3,
            "State": "active",
            "Tenancy": "default",
            "EbsOptimized": false,
            "InstanceType": "m5.large"
        }
    }

For more information, see `Creating a Capacity Reservation <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/capacity-reservations-using.html#capacity-reservations-create>`__ in the *Amazon Elastic Compute Cloud User Guide for Linux Instances*.