# CfnCapacityReservationProps

Properties for defining a `CfnCapacityReservation`.

Used as props by: [CfnCapacityReservation](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.CfnCapacityReservation.html)

- Source: Generated at build time
- Type last changed: v2.234.0 · 8 Jan 2026

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
const cfnCapacityReservationProps: ec2.CfnCapacityReservationProps = {
  instanceCount: 123,
  instancePlatform: 'instancePlatform',
  instanceType: 'instanceType',

  // the properties below are optional
  availabilityZone: 'availabilityZone',
  availabilityZoneId: 'availabilityZoneId',
  ebsOptimized: false,
  endDate: 'endDate',
  endDateType: 'endDateType',
  ephemeralStorage: false,
  instanceMatchCriteria: 'instanceMatchCriteria',
  outPostArn: 'outPostArn',
  placementGroupArn: 'placementGroupArn',
  tagSpecifications: [{
    resourceType: 'resourceType',
    tags: [{
      key: 'key',
      value: 'value',
    }],
  }],
  tenancy: 'tenancy',
  unusedReservationBillingOwnerId: 'unusedReservationBillingOwnerId',
};
```

Python:

```python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ec2 as ec2

cfn_capacity_reservation_props = ec2.CfnCapacityReservationProps(
    instance_count=123,
    instance_platform="instancePlatform",
    instance_type="instanceType",

    # the properties below are optional
    availability_zone="availabilityZone",
    availability_zone_id="availabilityZoneId",
    ebs_optimized=False,
    end_date="endDate",
    end_date_type="endDateType",
    ephemeral_storage=False,
    instance_match_criteria="instanceMatchCriteria",
    out_post_arn="outPostArn",
    placement_group_arn="placementGroupArn",
    tag_specifications=[ec2.CfnCapacityReservation.TagSpecificationProperty(
        resource_type="resourceType",
        tags=[CfnTag(
            key="key",
            value="value"
        )]
    )],
    tenancy="tenancy",
    unused_reservation_billing_owner_id="unusedReservationBillingOwnerId"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ec2.*;

CfnCapacityReservationProps cfnCapacityReservationProps = CfnCapacityReservationProps.builder()
        .instanceCount(123)
        .instancePlatform("instancePlatform")
        .instanceType("instanceType")

        // the properties below are optional
        .availabilityZone("availabilityZone")
        .availabilityZoneId("availabilityZoneId")
        .ebsOptimized(false)
        .endDate("endDate")
        .endDateType("endDateType")
        .ephemeralStorage(false)
        .instanceMatchCriteria("instanceMatchCriteria")
        .outPostArn("outPostArn")
        .placementGroupArn("placementGroupArn")
        .tagSpecifications(List.of(TagSpecificationProperty.builder()
                .resourceType("resourceType")
                .tags(List.of(CfnTag.builder()
                        .key("key")
                        .value("value")
                        .build()))
                .build()))
        .tenancy("tenancy")
        .unusedReservationBillingOwnerId("unusedReservationBillingOwnerId")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;

var cfnCapacityReservationProps = new CfnCapacityReservationProps {
    InstanceCount = 123,
    InstancePlatform = "instancePlatform",
    InstanceType = "instanceType",

    // the properties below are optional
    AvailabilityZone = "availabilityZone",
    AvailabilityZoneId = "availabilityZoneId",
    EbsOptimized = false,
    EndDate = "endDate",
    EndDateType = "endDateType",
    EphemeralStorage = false,
    InstanceMatchCriteria = "instanceMatchCriteria",
    OutPostArn = "outPostArn",
    PlacementGroupArn = "placementGroupArn",
    TagSpecifications = new [] { new TagSpecificationProperty {
        ResourceType = "resourceType",
        Tags = new [] { new CfnTag {
            Key = "key",
            Value = "value"
        } }
    } },
    Tenancy = "tenancy",
    UnusedReservationBillingOwnerId = "unusedReservationBillingOwnerId"
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnCapacityReservationProps := &CfnCapacityReservationProps{
	InstanceCount: jsii.Number(123),
	InstancePlatform: jsii.String("instancePlatform"),
	InstanceType: jsii.String("instanceType"),

	// the properties below are optional
	AvailabilityZone: jsii.String("availabilityZone"),
	AvailabilityZoneId: jsii.String("availabilityZoneId"),
	EbsOptimized: jsii.Boolean(false),
	EndDate: jsii.String("endDate"),
	EndDateType: jsii.String("endDateType"),
	EphemeralStorage: jsii.Boolean(false),
	InstanceMatchCriteria: jsii.String("instanceMatchCriteria"),
	OutPostArn: jsii.String("outPostArn"),
	PlacementGroupArn: jsii.String("placementGroupArn"),
	TagSpecifications: []interface{}{
		&TagSpecificationProperty{
			ResourceType: jsii.String("resourceType"),
			Tags: []CfnTag{
				&CfnTag{
					Key: jsii.String("key"),
					Value: jsii.String("value"),
				},
			},
		},
	},
	Tenancy: jsii.String("tenancy"),
	UnusedReservationBillingOwnerId: jsii.String("unusedReservationBillingOwnerId"),
}
```

## Properties

- `availabilityZone`: string — The Availability Zone in which to create the Capacity Reservation.

- `availabilityZoneId`: string — The ID of the Availability Zone in which the capacity is reserved.

- `ebsOptimized`: boolean | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — Indicates whether the Capacity Reservation supports EBS-optimized instances.

  This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS- optimized instance.

- `endDate`: string — The date and time at which the Capacity Reservation expires.

  When a Capacity Reservation expires, the reserved capacity is released and you can no longer launch instances into it. The Capacity Reservation's state changes to `expired` when it reaches its end date and time.

  You must provide an `EndDate` value if `EndDateType` is `limited` . Omit `EndDate` if `EndDateType` is `unlimited` .

  If the `EndDateType` is `limited` , the Capacity Reservation is cancelled within an hour from the specified time. For example, if you specify 5/31/2019, 13:30:55, the Capacity Reservation is guaranteed to end between 13:30:55 and 14:30:55 on 5/31/2019.

  If you are requesting a future-dated Capacity Reservation, you can't specify an end date and time that is within the commitment duration.

- `endDateType`: string — Indicates the way in which the Capacity Reservation ends.

  A Capacity Reservation can have one of the following end types:

  - `unlimited` - The Capacity Reservation remains active until you explicitly cancel it. Do not provide an `EndDate` if the `EndDateType` is `unlimited` .
  - `limited` - The Capacity Reservation expires automatically at a specified date and time. You must provide an `EndDate` value if the `EndDateType` value is `limited` .

- `ephemeralStorage`: boolean | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — *Deprecated.*.

- `instanceCount`: number (required) — The number of instances for which to reserve capacity.

  > You can request future-dated Capacity Reservations for an instance count with a minimum of 32 vCPUs. For example, if you request a future-dated Capacity Reservation for `m5.xlarge` instances, you must request at least 8 instances ( *8 * m5.xlarge = 32 vCPUs* ).

  Valid range: 1 - 1000

- `instanceMatchCriteria`: string — Indicates the type of instance launches that the Capacity Reservation accepts. The options include:.

  - `open` - The Capacity Reservation automatically matches all instances that have matching attributes (instance type, platform, and Availability Zone). Instances that have matching attributes run in the Capacity Reservation automatically without specifying any additional parameters.
  - `targeted` - The Capacity Reservation only accepts instances that have matching attributes (instance type, platform, and Availability Zone), and explicitly target the Capacity Reservation. This ensures that only permitted instances can use the reserved capacity.

  > If you are requesting a future-dated Capacity Reservation, you must specify `targeted` .

  Default: `open`

- `instancePlatform`: string (required) — The type of operating system for which to reserve capacity.

- `instanceType`: string (required) — The instance type for which to reserve capacity.

  > You can request future-dated Capacity Reservations for instance types in the C, M, R, I, T, and G instance families only.

  For more information, see [Instance types](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) in the *Amazon EC2 User Guide* .

- `outPostArn`: string — > Not supported for future-dated Capacity Reservations.

  The Amazon Resource Name (ARN) of the Outpost on which to create the Capacity Reservation.

- `placementGroupArn`: string — > Not supported for future-dated Capacity Reservations.

  The Amazon Resource Name (ARN) of the cluster placement group in which to create the Capacity Reservation. For more information, see [Capacity Reservations for cluster placement groups](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/cr-cpg.html) in the *Amazon EC2 User Guide* .

- `tagSpecifications`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnCapacityReservation.TagSpecificationProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.CfnCapacityReservation.TagSpecificationProperty.html)[] — The tags to apply to the Capacity Reservation during launch.

- `tenancy`: string — Indicates the tenancy of the Capacity Reservation. A Capacity Reservation can have one of the following tenancy settings:.

  - `default` - The Capacity Reservation is created on hardware that is shared with other AWS accounts .
  - `dedicated` - The Capacity Reservation is created on single-tenant hardware that is dedicated to a single AWS account .

- `unusedReservationBillingOwnerId`: string — The ID of the AWS account to which to assign billing of the unused capacity of the Capacity Reservation.

  A request will be sent to the specified account. That account must accept the request for the billing to be assigned to their account. For more information, see [Billing assignment for shared Amazon EC2 Capacity Reservations](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/assign-billing.html) .

  You can assign billing only for shared Capacity Reservations. To share a Capacity Reservation, you must add it to a resource share. For more information, see [AWS::RAM::ResourceShare](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ram-resourceshare.html) .
