capacity_reservations
Creates, updates, deletes, gets or lists a capacity_reservations resource.
Overview
| Name | capacity_reservations |
| Type | Resource |
| Id | aws.ec2.capacity_reservations |
Fields
The following fields are returned by SELECT queries:
- describe_capacity_reservations
| Name | Datatype | Description |
|---|---|---|
availability_zone | string | The Availability Zone in which the capacity is reserved. |
availability_zone_id | string | The ID of the Availability Zone in which the capacity is reserved. |
available_instance_count | integer | The remaining capacity. Indicates the number of instances that can be launched in the Capacity Reservation. |
capacity_allocations | string | Information about instance capacity usage. |
capacity_block_id | string | The ID of the Capacity Block. |
capacity_reservation_arn | string | The Amazon Resource Name (ARN) of the Capacity Reservation. |
capacity_reservation_fleet_id | string | The ID of the Capacity Reservation Fleet to which the Capacity Reservation belongs. Only valid for Capacity Reservations that were created by a Capacity Reservation Fleet. |
capacity_reservation_id | string | The ID of the Capacity Reservation. |
commitment_info | string | Information about your commitment for a future-dated Capacity Reservation. |
create_date | string | The date and time the Capacity Reservation was created. |
delivery_preference | string | The delivery method for a future-dated Capacity Reservation. incremental indicates that the requested capacity is delivered in addition to any running instances and reserved capacity that you have in your account at the requested date and time. |
ebs_optimized | boolean | 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. |
end_date | string | The date and time 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. |
end_date_type | 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. limited - The Capacity Reservation expires automatically at a specified date and time. |
ephemeral_storage | boolean | Deprecated. |
instance_match_criteria | string | Indicates the type of instance launches that the Capacity Reservation accepts. The options include: open - The Capacity Reservation accepts all instances that have matching attributes (instance type, platform, and Availability Zone). Instances that have matching attributes launch into 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. |
instance_platform | string | The type of operating system for which the Capacity Reservation reserves capacity. |
instance_type | string | The type of instance for which the Capacity Reservation reserves capacity. |
interruptible | boolean | Indicates whether this Capacity Reservation is interruptible, meaning instances may be terminated when the owner reclaims capacity. |
interruptible_capacity_allocation | string | Contains allocation details for interruptible reservations, including current allocated instances and target instance counts within the interruptibleCapacityAllocation object. |
interruption_info | string | Information about the interruption configuration and association with the source reservation for interruptible Capacity Reservations. |
outpost_arn | string | The Amazon Resource Name (ARN) of the Outpost on which the Capacity Reservation was created. |
owner_id | string | The ID of the Amazon Web Services account that owns the Capacity Reservation. |
placement_group_arn | string | The Amazon Resource Name (ARN) of the cluster placement group in which the Capacity Reservation was created. For more information, see Capacity Reservations for cluster placement groups in the Amazon EC2 User Guide. |
reservation_type | string | The type of Capacity Reservation. |
start_date | string | The date and time the Capacity Reservation was started. |
state | string | The current state of the Capacity Reservation. A Capacity Reservation can be in one of the following states: active - The capacity is available for use. expired - The Capacity Reservation expired automatically at the date and time specified in your reservation request. The reserved capacity is no longer available for your use. cancelled - The Capacity Reservation was canceled. The reserved capacity is no longer available for your use. pending - The Capacity Reservation request was successful but the capacity provisioning is still pending. failed - The Capacity Reservation request has failed. A request can fail due to request parameters that are not valid, capacity constraints, or instance limit constraints. You can view a failed request for 60 minutes. scheduled - (Future-dated Capacity Reservations) The future-dated Capacity Reservation request was approved and the Capacity Reservation is scheduled for delivery on the requested start date. payment-pending - (Capacity Blocks) The upfront payment has not been processed yet. payment-failed - (Capacity Blocks) The upfront payment was not processed in the 12-hour time frame. Your Capacity Block was released. assessing - (Future-dated Capacity Reservations) Amazon EC2 is assessing your request for a future-dated Capacity Reservation. delayed - (Future-dated Capacity Reservations) Amazon EC2 encountered a delay in provisioning the requested future-dated Capacity Reservation. Amazon EC2 is unable to deliver the requested capacity by the requested start date and time. unsupported - (Future-dated Capacity Reservations) Amazon EC2 can't support the future-dated Capacity Reservation request due to capacity constraints. You can view unsupported requests for 30 days. The Capacity Reservation will not be delivered. cancelling - (Future-dated Capacity Reservations) The Capacity Reservation is being cancelled. Capacity has been released but charges continue for the commitment wind-down period. The reservation transitions to cancelled when the wind-down completes. |
tags | string | Any tags assigned to the Capacity Reservation. |
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 Amazon Web Services accounts. dedicated - The Capacity Reservation is created on single-tenant hardware that is dedicated to a single Amazon Web Services account. |
total_instance_count | integer | The total number of instances for which the Capacity Reservation reserves capacity. |
unused_reservation_billing_owner_id | string | The ID of the Amazon Web Services account to which billing of the unused capacity of the Capacity Reservation is assigned. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_capacity_reservations | select | region | CapacityReservationId, NextToken, MaxResults, Filter, DryRun | Describes one or more of your Capacity Reservations. The results describe only the Capacity Reservations in the Amazon Web Services Region that you're currently using. |
create_capacity_reservation | insert | InstanceType, InstancePlatform, InstanceCount, region | ClientToken, AvailabilityZone, AvailabilityZoneId, Tenancy, EbsOptimized, EphemeralStorage, EndDate, EndDateType, InstanceMatchCriteria, TagSpecifications, DryRun, OutpostArn, PlacementGroupArn, StartDate, CommitmentDuration, DeliveryPreference | Creates a new Capacity Reservation with the specified attributes. Capacity Reservations enable you to reserve capacity for your Amazon EC2 instances in a specific Availability Zone for any duration. You can create a Capacity Reservation at any time, and you can choose when it starts. You can create a Capacity Reservation for immediate use or you can request a Capacity Reservation for a future date. For more information, see Reserve compute capacity with On-Demand Capacity Reservations in the Amazon EC2 User Guide. Your request to create a Capacity Reservation could fail if: Amazon EC2 does not have sufficient capacity. In this case, try again at a later time, try in a different Availability Zone, or request a smaller Capacity Reservation. If your workload is flexible across instance types and sizes, try with different instance attributes. The requested quantity exceeds your On-Demand Instance quota. In this case, increase your On-Demand Instance quota for the requested instance type and try again. For more information, see Amazon EC2 Service Quotas in the Amazon EC2 User Guide. |
create_capacity_reservation_by_splitting | insert | SourceCapacityReservationId, InstanceCount, region | DryRun, ClientToken, TagSpecification | Create a new Capacity Reservation by splitting the capacity of the source Capacity Reservation. The new Capacity Reservation will have the same attributes as the source Capacity Reservation except for tags. The source Capacity Reservation must be active and owned by your Amazon Web Services account. |
create_interruptible_capacity_reservation_allocation | insert | CapacityReservationId, InstanceCount, region | ClientToken, DryRun, TagSpecification | Creates an interruptible Capacity Reservation by specifying the number of unused instances you want to allocate from your source reservation. This helps you make unused capacity available for other workloads within your account while maintaining control to reclaim it. |
associate_capacity_reservation_billing_owner | update | CapacityReservationId, UnusedReservationBillingOwnerId, region | DryRun | Initiates a request to assign billing of the unused capacity of a shared Capacity Reservation to a consumer account that is consolidated under the same Amazon Web Services organizations payer account. For more information, see Billing assignment for shared Amazon EC2 Capacity Reservations. |
update_interruptible_capacity_reservation_allocation | update | CapacityReservationId, TargetInstanceCount, region | DryRun | Modifies the number of instances allocated to an interruptible reservation, allowing you to add more capacity or reclaim capacity to your source Capacity Reservation. |
modify_capacity_reservation | update | CapacityReservationId, region | InstanceCount, EndDate, EndDateType, Accept, DryRun, AdditionalInfo, InstanceMatchCriteria | Modifies a Capacity Reservation's capacity, instance eligibility, and the conditions under which it is to be released. You can't modify a Capacity Reservation's instance type, EBS optimization, platform, instance store settings, Availability Zone, or tenancy. If you need to modify any of these attributes, we recommend that you cancel the Capacity Reservation, and then create a new one with the required attributes. For more information, see Modify an active Capacity Reservation. The allowed modifications depend on the state of the Capacity Reservation: assessing or scheduled state - You can modify the tags only. pending state - You can't modify the Capacity Reservation in any way. active state but still within the commitment duration - You can't decrease the instance count or set an end date that is within the commitment duration. All other modifications are allowed. active state with no commitment duration or elapsed commitment duration - All modifications are allowed. expired, cancelled, unsupported, or failed state - You can't modify the Capacity Reservation in any way. |
accept_capacity_reservation_billing_ownership | exec | CapacityReservationId, region | DryRun | Accepts a request to assign billing of the available capacity of a shared Capacity Reservation to your account. For more information, see Billing assignment for shared Amazon EC2 Capacity Reservations. |
cancel_capacity_reservation | exec | CapacityReservationId, region | DryRun, ApplyCancellationCharges, QuoteId | Cancels the specified Capacity Reservation, releases the reserved capacity, and changes the Capacity Reservation's state to cancelled. You can cancel a Capacity Reservation that is in the following states: assessing scheduled — requires a cancellation quote. Use CreateCapacityReservationCancellationQuote to generate a quote, then pass the quote ID with ApplyCancellationCharges set to commitment-wind-down. The cancellation charge depends on how close the reservation is to its start date. active and there is no commitment duration or the commitment duration has elapsed. active during the commitment duration — requires a cancellation quote. Use CreateCapacityReservationCancellationQuote to generate a quote, then pass the quote ID with ApplyCancellationCharges set to commitment-wind-down. The Capacity Reservation transitions to cancelling while charges are applied. delayed — the commitment duration is waived, so no cancellation charge applies. You can't modify or cancel a Capacity Block. For more information, see Capacity Blocks for ML. Instances running in the reserved capacity continue running until you stop them. Stopped instances that target the Capacity Reservation can no longer launch. Modify these instances to either target a different Capacity Reservation, launch On-Demand Instance capacity, or run in any open Capacity Reservation that has matching attributes and sufficient capacity. |
disassociate_capacity_reservation_billing_owner | exec | CapacityReservationId, UnusedReservationBillingOwnerId, region | DryRun | Cancels a pending request to assign billing of the unused capacity of a Capacity Reservation to a consumer account, or revokes a request that has already been accepted. For more information, see Billing assignment for shared Amazon EC2 Capacity Reservations. |
reject_capacity_reservation_billing_ownership | exec | CapacityReservationId, region | DryRun | Rejects a request to assign billing of the available capacity of a shared Capacity Reservation to your account. For more information, see Billing assignment for shared Amazon EC2 Capacity Reservations. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
CapacityReservationId | string | The ID of the Capacity Reservation for which to reject the request. |
InstanceCount | integer | The number of instances to allocate from your source reservation. You can only allocate available instances (also called unused capacity). |
InstancePlatform | string | The type of operating system for which to reserve capacity. |
InstanceType | string | 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 in the Amazon EC2 User Guide. |
SourceCapacityReservationId | string | The ID of the Capacity Reservation from which you want to split the capacity. |
TargetInstanceCount | integer | The new number of instances to allocate. Enter a higher number to add more capacity to share, or a lower number to reclaim capacity to your source Capacity Reservation. |
UnusedReservationBillingOwnerId | string | The ID of the consumer account to which the request was sent. |
region | string | AWS region (default: us-east-1) |
Accept | boolean | Reserved. Capacity Reservations you have created are accepted by default. |
AdditionalInfo | string | Reserved for future use. |
ApplyCancellationCharges | string | Specifies the cancellation charge type to apply when cancelling a future-dated Capacity Reservation during its commitment duration. Possible values include commitment-wind-down, which continues billing for the remaining commitment duration without delivering capacity. |
AvailabilityZone | string | The Availability Zone in which to create the Capacity Reservation. |
AvailabilityZoneId | string | The ID of the Availability Zone in which to create the Capacity Reservation. |
CapacityReservationId | array | The ID of the Capacity Reservation. |
ClientToken | string | Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. |
CommitmentDuration | integer (int64) | Required for future-dated Capacity Reservations only. To create a Capacity Reservation for immediate use, omit this parameter. Specify a commitment duration, in seconds, for the future-dated Capacity Reservation. The commitment duration is a minimum duration for which you commit to having the future-dated Capacity Reservation in the active state in your account after it has been delivered. For more information, see Commitment duration. |
DeliveryPreference | string | Required for future-dated Capacity Reservations only. To create a Capacity Reservation for immediate use, omit this parameter. Indicates that the requested capacity will be delivered in addition to any running instances or reserved capacity that you have in your account at the requested date and time. The only supported value is incremental. |
DryRun | boolean | Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation. |
EbsOptimized | boolean | 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 (date-time) | 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. 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. You must provide an EndDate value if EndDateType is limited. Omit EndDate if EndDateType is unlimited. |
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 value if EndDateType is unlimited. limited - The Capacity Reservation expires automatically at a specified date and time. You must provide an EndDate value if EndDateType is limited. |
EphemeralStorage | boolean | Deprecated. |
Filter | array | One or more filters. instance-type - The type of instance for which the Capacity Reservation reserves capacity. owner-id - The ID of the Amazon Web Services account that owns the Capacity Reservation. instance-platform - The type of operating system for which the Capacity Reservation reserves capacity. availability-zone - The Availability Zone of the Capacity Reservation. tenancy - 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 Amazon Web Services accounts. dedicated - The Capacity Reservation is created on single-tenant hardware that is dedicated to a single Amazon Web Services account. outpost-arn - The Amazon Resource Name (ARN) of the Outpost on which the Capacity Reservation was created. state - The current state of the Capacity Reservation. A Capacity Reservation can be in one of the following states: active- The Capacity Reservation is active and the capacity is available for your use. expired - The Capacity Reservation expired automatically at the date and time specified in your request. The reserved capacity is no longer available for your use. cancelled - The Capacity Reservation was cancelled. The reserved capacity is no longer available for your use. pending - The Capacity Reservation request was successful but the capacity provisioning is still pending. failed - The Capacity Reservation request has failed. A request might fail due to invalid request parameters, capacity constraints, or instance limit constraints. Failed requests are retained for 60 minutes. start-date - The date and time at which the Capacity Reservation was started. end-date - 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. end-date-type - 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. limited - The Capacity Reservation expires automatically at a specified date and time. instance-match-criteria - Indicates the type of instance launches that the Capacity Reservation accepts. The options include: open - The Capacity Reservation accepts all instances that have matching attributes (instance type, platform, and Availability Zone). Instances that have matching attributes launch into 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. placement-group-arn - The ARN of the cluster placement group in which the Capacity Reservation was created. |
InstanceCount | integer | The number of instances for which to reserve capacity. The number of instances can't be increased or decreased by more than 1000 in a single request. |
InstanceMatchCriteria | string | The matching criteria (instance eligibility) that you want to use in the modified Capacity Reservation. If you change the instance eligibility of an existing Capacity Reservation from targeted to open, any running instances that match the attributes of the Capacity Reservation, have the CapacityReservationPreference set to open, and are not yet running in the Capacity Reservation, will automatically use the modified Capacity Reservation. To modify the instance eligibility, the Capacity Reservation must be completely idle (zero usage). |
MaxResults | integer | The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see Pagination. |
NextToken | string | The token to use to retrieve the next page of results. |
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 in the Amazon EC2 User Guide. |
QuoteId | string | The ID of the cancellation quote to use for the cancellation. You can generate a cancellation quote by using the CreateCapacityReservationCancellationQuote action. The cancellation quote must be in an active state. |
StartDate | string (date-time) | Required for future-dated Capacity Reservations only. To create a Capacity Reservation for immediate use, omit this parameter. The date and time at which the future-dated Capacity Reservation should become available for use, in the ISO8601 format in the UTC time zone (YYYY-MM-DDThh:mm:ss.sssZ). You can request a future-dated Capacity Reservation between 5 and 120 days in advance. |
TagSpecification | array | The tags to apply to the interruptible Capacity Reservation during creation. |
TagSpecifications | array | 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 Amazon Web Services accounts. dedicated - The Capacity Reservation is created on single-tenant hardware that is dedicated to a single Amazon Web Services account. |
SELECT examples
- describe_capacity_reservations
Describes one or more of your Capacity Reservations. The results describe only the Capacity Reservations in the Amazon Web Services Region that you're currently using.
SELECT
availability_zone,
availability_zone_id,
available_instance_count,
capacity_allocations,
capacity_block_id,
capacity_reservation_arn,
capacity_reservation_fleet_id,
capacity_reservation_id,
commitment_info,
create_date,
delivery_preference,
ebs_optimized,
end_date,
end_date_type,
ephemeral_storage,
instance_match_criteria,
instance_platform,
instance_type,
interruptible,
interruptible_capacity_allocation,
interruption_info,
outpost_arn,
owner_id,
placement_group_arn,
reservation_type,
start_date,
state,
tags,
tenancy,
total_instance_count,
unused_reservation_billing_owner_id
FROM aws.ec2.capacity_reservations
WHERE region = '{{ region }}' -- required
AND CapacityReservationId = '{{ CapacityReservationId }}'
AND NextToken = '{{ NextToken }}'
AND MaxResults = '{{ MaxResults }}'
AND Filter = '{{ Filter }}'
AND DryRun = '{{ DryRun }}'
;
INSERT examples
- create_capacity_reservation
- create_capacity_reservation_by_splitting
- create_interruptible_capacity_reservation_allocation
- Manifest
Creates a new Capacity Reservation with the specified attributes. Capacity Reservations enable you to reserve capacity for your Amazon EC2 instances in a specific Availability Zone for any duration. You can create a Capacity Reservation at any time, and you can choose when it starts. You can create a Capacity Reservation for immediate use or you can request a Capacity Reservation for a future date. For more information, see Reserve compute capacity with On-Demand Capacity Reservations in the Amazon EC2 User Guide. Your request to create a Capacity Reservation could fail if: Amazon EC2 does not have sufficient capacity. In this case, try again at a later time, try in a different Availability Zone, or request a smaller Capacity Reservation. If your workload is flexible across instance types and sizes, try with different instance attributes. The requested quantity exceeds your On-Demand Instance quota. In this case, increase your On-Demand Instance quota for the requested instance type and try again. For more information, see Amazon EC2 Service Quotas in the Amazon EC2 User Guide.
INSERT INTO aws.ec2.capacity_reservations (
InstanceType,
InstancePlatform,
InstanceCount,
region,
ClientToken,
AvailabilityZone,
AvailabilityZoneId,
Tenancy,
EbsOptimized,
EphemeralStorage,
EndDate,
EndDateType,
InstanceMatchCriteria,
TagSpecifications,
DryRun,
OutpostArn,
PlacementGroupArn,
StartDate,
CommitmentDuration,
DeliveryPreference
)
SELECT
'{{ InstanceType }}',
'{{ InstancePlatform }}',
'{{ InstanceCount }}',
'{{ region }}',
'{{ ClientToken }}',
'{{ AvailabilityZone }}',
'{{ AvailabilityZoneId }}',
'{{ Tenancy }}',
'{{ EbsOptimized }}',
'{{ EphemeralStorage }}',
'{{ EndDate }}',
'{{ EndDateType }}',
'{{ InstanceMatchCriteria }}',
'{{ TagSpecifications }}',
'{{ DryRun }}',
'{{ OutpostArn }}',
'{{ PlacementGroupArn }}',
'{{ StartDate }}',
'{{ CommitmentDuration }}',
'{{ DeliveryPreference }}'
RETURNING
availability_zone,
availability_zone_id,
available_instance_count,
capacity_allocations,
capacity_block_id,
capacity_reservation_arn,
capacity_reservation_fleet_id,
capacity_reservation_id,
commitment_info,
create_date,
delivery_preference,
ebs_optimized,
end_date,
end_date_type,
ephemeral_storage,
instance_match_criteria,
instance_platform,
instance_type,
interruptible,
interruptible_capacity_allocation,
interruption_info,
outpost_arn,
owner_id,
placement_group_arn,
reservation_type,
start_date,
state,
tags,
tenancy,
total_instance_count,
unused_reservation_billing_owner_id
;
Create a new Capacity Reservation by splitting the capacity of the source Capacity Reservation. The new Capacity Reservation will have the same attributes as the source Capacity Reservation except for tags. The source Capacity Reservation must be active and owned by your Amazon Web Services account.
INSERT INTO aws.ec2.capacity_reservations (
SourceCapacityReservationId,
InstanceCount,
region,
DryRun,
ClientToken,
TagSpecification
)
SELECT
'{{ SourceCapacityReservationId }}',
'{{ InstanceCount }}',
'{{ region }}',
'{{ DryRun }}',
'{{ ClientToken }}',
'{{ TagSpecification }}'
RETURNING
destination_capacity_reservation,
instance_count,
source_capacity_reservation
;
Creates an interruptible Capacity Reservation by specifying the number of unused instances you want to allocate from your source reservation. This helps you make unused capacity available for other workloads within your account while maintaining control to reclaim it.
INSERT INTO aws.ec2.capacity_reservations (
CapacityReservationId,
InstanceCount,
region,
ClientToken,
DryRun,
TagSpecification
)
SELECT
'{{ CapacityReservationId }}',
'{{ InstanceCount }}',
'{{ region }}',
'{{ ClientToken }}',
'{{ DryRun }}',
'{{ TagSpecification }}'
RETURNING
interruption_type,
source_capacity_reservation_id,
status,
target_instance_count
;
# Description fields are for documentation purposes
- name: capacity_reservations
props:
- name: InstanceType
value: "{{ InstanceType }}"
description: Required parameter for the capacity_reservations resource.
- name: InstancePlatform
value: "{{ InstancePlatform }}"
description: Required parameter for the capacity_reservations resource.
- name: InstanceCount
value: {{ InstanceCount }}
description: Required parameter for the capacity_reservations resource.
- name: region
value: "{{ region }}"
description: Required parameter for the capacity_reservations resource.
- name: SourceCapacityReservationId
value: "{{ SourceCapacityReservationId }}"
description: Required parameter for the capacity_reservations resource.
- name: CapacityReservationId
value: "{{ CapacityReservationId }}"
description: Required parameter for the capacity_reservations resource.
- name: ClientToken
value: "{{ ClientToken }}"
description: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensure Idempotency.
description: Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensure Idempotency.
- name: AvailabilityZone
value: "{{ AvailabilityZone }}"
description: The Availability Zone in which to create the Capacity Reservation.
description: The Availability Zone in which to create the Capacity Reservation.
- name: AvailabilityZoneId
value: "{{ AvailabilityZoneId }}"
description: The ID of the Availability Zone in which to create the Capacity Reservation.
description: The ID of the Availability Zone in which to create the Capacity Reservation.
- name: Tenancy
value: "{{ Tenancy }}"
description: 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 Amazon Web Services accounts. dedicated - The Capacity Reservation is created on single-tenant hardware that is dedicated to a single Amazon Web Services account.
description: 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 Amazon Web Services accounts. dedicated - The Capacity Reservation is created on single-tenant hardware that is dedicated to a single Amazon Web Services account.
- name: EbsOptimized
value: {{ EbsOptimized }}
description: 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.
description: 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.
- name: EphemeralStorage
value: {{ EphemeralStorage }}
description: Deprecated.
description: Deprecated.
- name: EndDate
value: "{{ EndDate }}"
description: 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.
description: 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.
- name: EndDateType
value: "{{ EndDateType }}"
description: 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.
description: 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.
- name: InstanceMatchCriteria
value: "{{ InstanceMatchCriteria }}"
description: 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
description: 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
- name: TagSpecifications
value: "{{ TagSpecifications }}"
description: The tags to apply to the Capacity Reservation during launch.
description: The tags to apply to the Capacity Reservation during launch.
- name: DryRun
value: {{ DryRun }}
description: Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.
description: Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.
- name: OutpostArn
value: "{{ OutpostArn }}"
description: Not supported for future-dated Capacity Reservations. The Amazon Resource Name (ARN) of the Outpost on which to create the Capacity Reservation.
description: Not supported for future-dated Capacity Reservations. The Amazon Resource Name (ARN) of the Outpost on which to create the Capacity Reservation.
- name: PlacementGroupArn
value: "{{ PlacementGroupArn }}"
description: 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 in the Amazon EC2 User Guide.
description: 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 in the Amazon EC2 User Guide.
- name: StartDate
value: "{{ StartDate }}"
description: Required for future-dated Capacity Reservations only. To create a Capacity Reservation for immediate use, omit this parameter. The date and time at which the future-dated Capacity Reservation should become available for use, in the ISO8601 format in the UTC time zone (YYYY-MM-DDThh:mm:ss.sssZ). You can request a future-dated Capacity Reservation between 5 and 120 days in advance.
description: Required for future-dated Capacity Reservations only. To create a Capacity Reservation for immediate use, omit this parameter. The date and time at which the future-dated Capacity Reservation should become available for use, in the ISO8601 format in the UTC time zone (YYYY-MM-DDThh:mm:ss.sssZ). You can request a future-dated Capacity Reservation between 5 and 120 days in advance.
- name: CommitmentDuration
value: "{{ CommitmentDuration }}"
description: Required for future-dated Capacity Reservations only. To create a Capacity Reservation for immediate use, omit this parameter. Specify a commitment duration, in seconds, for the future-dated Capacity Reservation. The commitment duration is a minimum duration for which you commit to having the future-dated Capacity Reservation in the active state in your account after it has been delivered. For more information, see Commitment duration.
description: Required for future-dated Capacity Reservations only. To create a Capacity Reservation for immediate use, omit this parameter. Specify a commitment duration, in seconds, for the future-dated Capacity Reservation. The commitment duration is a minimum duration for which you commit to having the future-dated Capacity Reservation in the active state in your account after it has been delivered. For more information, see Commitment duration.
- name: DeliveryPreference
value: "{{ DeliveryPreference }}"
description: Required for future-dated Capacity Reservations only. To create a Capacity Reservation for immediate use, omit this parameter. Indicates that the requested capacity will be delivered in addition to any running instances or reserved capacity that you have in your account at the requested date and time. The only supported value is incremental.
description: Required for future-dated Capacity Reservations only. To create a Capacity Reservation for immediate use, omit this parameter. Indicates that the requested capacity will be delivered in addition to any running instances or reserved capacity that you have in your account at the requested date and time. The only supported value is incremental.
- name: TagSpecification
value: "{{ TagSpecification }}"
description: The tags to apply to the new Capacity Reservation.
description: The tags to apply to the new Capacity Reservation.
UPDATE examples
- associate_capacity_reservation_billing_owner
- update_interruptible_capacity_reservation_allocation
- modify_capacity_reservation
Initiates a request to assign billing of the unused capacity of a shared Capacity Reservation to a consumer account that is consolidated under the same Amazon Web Services organizations payer account. For more information, see Billing assignment for shared Amazon EC2 Capacity Reservations.
UPDATE aws.ec2.capacity_reservations
SET
-- No updatable properties
WHERE
CapacityReservationId = '{{ CapacityReservationId }}' --required
AND UnusedReservationBillingOwnerId = '{{ UnusedReservationBillingOwnerId }}' --required
AND region = '{{ region }}' --required
AND DryRun = {{ DryRun}}
RETURNING
return;
Modifies the number of instances allocated to an interruptible reservation, allowing you to add more capacity or reclaim capacity to your source Capacity Reservation.
UPDATE aws.ec2.capacity_reservations
SET
-- No updatable properties
WHERE
CapacityReservationId = '{{ CapacityReservationId }}' --required
AND TargetInstanceCount = '{{ TargetInstanceCount }}' --required
AND region = '{{ region }}' --required
AND DryRun = {{ DryRun}}
RETURNING
instance_count,
interruptible_capacity_reservation_id,
interruption_type,
source_capacity_reservation_id,
status,
target_instance_count;
Modifies a Capacity Reservation's capacity, instance eligibility, and the conditions under which it is to be released. You can't modify a Capacity Reservation's instance type, EBS optimization, platform, instance store settings, Availability Zone, or tenancy. If you need to modify any of these attributes, we recommend that you cancel the Capacity Reservation, and then create a new one with the required attributes. For more information, see Modify an active Capacity Reservation. The allowed modifications depend on the state of the Capacity Reservation: assessing or scheduled state - You can modify the tags only. pending state - You can't modify the Capacity Reservation in any way. active state but still within the commitment duration - You can't decrease the instance count or set an end date that is within the commitment duration. All other modifications are allowed. active state with no commitment duration or elapsed commitment duration - All modifications are allowed. expired, cancelled, unsupported, or failed state - You can't modify the Capacity Reservation in any way.
UPDATE aws.ec2.capacity_reservations
SET
-- No updatable properties
WHERE
CapacityReservationId = '{{ CapacityReservationId }}' --required
AND region = '{{ region }}' --required
AND InstanceCount = '{{ InstanceCount}}'
AND EndDate = '{{ EndDate}}'
AND EndDateType = '{{ EndDateType}}'
AND Accept = {{ Accept}}
AND DryRun = {{ DryRun}}
AND AdditionalInfo = '{{ AdditionalInfo}}'
AND InstanceMatchCriteria = '{{ InstanceMatchCriteria}}'
RETURNING
return;
Lifecycle Methods
- accept_capacity_reservation_billing_ownership
- cancel_capacity_reservation
- disassociate_capacity_reservation_billing_owner
- reject_capacity_reservation_billing_ownership
Accepts a request to assign billing of the available capacity of a shared Capacity Reservation to your account. For more information, see Billing assignment for shared Amazon EC2 Capacity Reservations.
EXEC aws.ec2.capacity_reservations.accept_capacity_reservation_billing_ownership
@CapacityReservationId='{{ CapacityReservationId }}' --required,
@region='{{ region }}' --required,
@DryRun={{ DryRun }}
;
Cancels the specified Capacity Reservation, releases the reserved capacity, and changes the Capacity Reservation's state to cancelled. You can cancel a Capacity Reservation that is in the following states: assessing scheduled — requires a cancellation quote. Use CreateCapacityReservationCancellationQuote to generate a quote, then pass the quote ID with ApplyCancellationCharges set to commitment-wind-down. The cancellation charge depends on how close the reservation is to its start date. active and there is no commitment duration or the commitment duration has elapsed. active during the commitment duration — requires a cancellation quote. Use CreateCapacityReservationCancellationQuote to generate a quote, then pass the quote ID with ApplyCancellationCharges set to commitment-wind-down. The Capacity Reservation transitions to cancelling while charges are applied. delayed — the commitment duration is waived, so no cancellation charge applies. You can't modify or cancel a Capacity Block. For more information, see Capacity Blocks for ML. Instances running in the reserved capacity continue running until you stop them. Stopped instances that target the Capacity Reservation can no longer launch. Modify these instances to either target a different Capacity Reservation, launch On-Demand Instance capacity, or run in any open Capacity Reservation that has matching attributes and sufficient capacity.
EXEC aws.ec2.capacity_reservations.cancel_capacity_reservation
@CapacityReservationId='{{ CapacityReservationId }}' --required,
@region='{{ region }}' --required,
@DryRun={{ DryRun }},
@ApplyCancellationCharges='{{ ApplyCancellationCharges }}',
@QuoteId='{{ QuoteId }}'
;
Cancels a pending request to assign billing of the unused capacity of a Capacity Reservation to a consumer account, or revokes a request that has already been accepted. For more information, see Billing assignment for shared Amazon EC2 Capacity Reservations.
EXEC aws.ec2.capacity_reservations.disassociate_capacity_reservation_billing_owner
@CapacityReservationId='{{ CapacityReservationId }}' --required,
@UnusedReservationBillingOwnerId='{{ UnusedReservationBillingOwnerId }}' --required,
@region='{{ region }}' --required,
@DryRun={{ DryRun }}
;
Rejects a request to assign billing of the available capacity of a shared Capacity Reservation to your account. For more information, see Billing assignment for shared Amazon EC2 Capacity Reservations.
EXEC aws.ec2.capacity_reservations.reject_capacity_reservation_billing_ownership
@CapacityReservationId='{{ CapacityReservationId }}' --required,
@region='{{ region }}' --required,
@DryRun={{ DryRun }}
;