Skip to main content

capacity_reservations

Creates, updates, deletes or gets a capacity_reservation resource or lists capacity_reservations in a region

Overview

Namecapacity_reservations
TypeResource
DescriptionResource Type definition for AWS::EC2::CapacityReservation
Idaws.ec2.capacity_reservations

Fields

NameDatatypeDescription
tenancystring
end_date_typestring
tag_specificationsarray
availability_zonestring
total_instance_countinteger
end_datestring
ebs_optimizedboolean
out_post_arnstring
instance_countinteger
placement_group_arnstring
available_instance_countinteger
instance_platformstring
idstring
instance_typestring
ephemeral_storageboolean
instance_match_criteriastring
regionstringAWS region.

Methods

NameAccessible byRequired Params
create_resourceINSERTInstanceCount, AvailabilityZone, InstancePlatform, InstanceType, region
delete_resourceDELETEdata__Identifier, region
update_resourceUPDATEdata__Identifier, data__PatchDocument, region
list_resourcesSELECTregion
get_resourceSELECTdata__Identifier, region

SELECT examples

Gets all capacity_reservations in a region.

SELECT
region,
tenancy,
end_date_type,
tag_specifications,
availability_zone,
total_instance_count,
end_date,
ebs_optimized,
out_post_arn,
instance_count,
placement_group_arn,
available_instance_count,
instance_platform,
id,
instance_type,
ephemeral_storage,
instance_match_criteria
FROM aws.ec2.capacity_reservations
WHERE region = 'us-east-1';

Gets all properties from an individual capacity_reservation.

SELECT
region,
tenancy,
end_date_type,
tag_specifications,
availability_zone,
total_instance_count,
end_date,
ebs_optimized,
out_post_arn,
instance_count,
placement_group_arn,
available_instance_count,
instance_platform,
id,
instance_type,
ephemeral_storage,
instance_match_criteria
FROM aws.ec2.capacity_reservations
WHERE region = 'us-east-1' AND data__Identifier = '<Id>';

INSERT example

Use the following StackQL query and manifest file to create a new capacity_reservation resource, using stack-deploy.

/*+ create */
INSERT INTO aws.ec2.capacity_reservations (
AvailabilityZone,
InstanceCount,
InstancePlatform,
InstanceType,
region
)
SELECT
'{{ AvailabilityZone }}',
'{{ InstanceCount }}',
'{{ InstancePlatform }}',
'{{ InstanceType }}',
'{{ region }}';

DELETE example

/*+ delete */
DELETE FROM aws.ec2.capacity_reservations
WHERE data__Identifier = '<Id>'
AND region = 'us-east-1';

Permissions

To operate on the capacity_reservations resource, the following permissions are required:

Create

ec2:CreateCapacityReservation,
ec2:DescribeCapacityReservations,
ec2:CancelCapacityReservation,
ec2:CreateTags

Delete

ec2:CreateCapacityReservation,
ec2:DescribeCapacityReservations,
ec2:CancelCapacityReservation,
ec2:DeleteTags

List

ec2:DescribeCapacityReservations

Read

ec2:DescribeCapacityReservations

Update

ec2:ModifyCapacityReservation,
ec2:CreateCapacityReservation,
ec2:DescribeCapacityReservations,
ec2:CancelCapacityReservation,
ec2:CreateTags,
ec2:DeleteTags