Skip to main content

capacity_block_offerings

Creates, updates, deletes, gets or lists a capacity_block_offerings resource.

Overview

Namecapacity_block_offerings
TypeResource
Idaws.ec2.capacity_block_offerings

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
availability_zonestringThe Availability Zone of the Capacity Block offering.
capacity_block_duration_hoursintegerThe number of hours (in addition to capacityBlockDurationMinutes) for the duration of the Capacity Block reservation. For example, if a Capacity Block starts at 04:55 and ends at 11:30, the hours field would be 6.
capacity_block_duration_minutesintegerThe number of minutes (in addition to capacityBlockDurationHours) for the duration of the Capacity Block reservation. For example, if a Capacity Block starts at 08:55 and ends at 11:30, the minutes field would be 35.
capacity_block_offering_idstringThe ID of the Capacity Block offering.
currency_codestringThe currency of the payment for the Capacity Block.
end_datestringThe end date of the Capacity Block offering.
instance_countintegerThe number of instances in the Capacity Block offering.
instance_typestringThe instance type of the Capacity Block offering.
start_datestringThe start date of the Capacity Block offering.
tenancystringThe tenancy of the Capacity Block.
ultraserver_countintegerThe number of EC2 UltraServers in the offering.
ultraserver_typestringThe EC2 UltraServer type of the Capacity Block offering.
upfront_feestringThe total price to be paid up front.
zone_typestringThe type of zone where the Capacity Block offering is available.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_capacity_block_offeringsselectCapacityDurationHours, regionDryRun, InstanceType, InstanceCount, StartDateRange, EndDateRange, NextToken, MaxResults, UltraserverType, UltraserverCount, AllAvailabilityZonesDescribes Capacity Block offerings available for purchase in the Amazon Web Services Region that you're currently using. With Capacity Blocks, you can purchase a specific GPU instance type or EC2 UltraServer for a period of time. To search for an available Capacity Block offering, you specify a reservation duration and instance count.
purchase_capacity_blockexecCapacityBlockOfferingId, InstancePlatform, regionDryRun, TagSpecificationPurchase the Capacity Block for use with your account. With Capacity Blocks you ensure GPU capacity is available for machine learning (ML) workloads. You must specify the ID of the Capacity Block offering you are purchasing.

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.

NameDatatypeDescription
CapacityBlockOfferingIdstringThe ID of the Capacity Block offering.
CapacityDurationHoursintegerThe reservation duration for the Capacity Block, in hours. You must specify the duration in 1-day increments up 14 days, and in 7-day increments up to 182 days.
InstancePlatformstringThe type of operating system for which to reserve capacity.
regionstringAWS region (default: us-east-1)
AllAvailabilityZonesbooleanInclude all Availability Zones and Local Zones, regardless of your opt-in status. If you do not use this parameter, the results include available offerings from all Availability Zones in the Amazon Web Services Region and Local Zones you are opted into.
DryRunbooleanChecks 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.
EndDateRangestring (date-time)The latest end date for the Capacity Block offering.
InstanceCountintegerThe number of instances for which to reserve capacity. Each Capacity Block can have up to 64 instances, and you can have up to 256 instances across Capacity Blocks.
InstanceTypestringThe type of instance for which the Capacity Block offering reserves capacity.
MaxResultsintegerThe 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.
NextTokenstringThe token to use to retrieve the next page of results.
StartDateRangestring (date-time)The earliest start date for the Capacity Block offering.
TagSpecificationarrayThe tags to apply to the Capacity Block during launch.
UltraserverCountintegerThe number of EC2 UltraServers in the offerings.
UltraserverTypestringThe EC2 UltraServer type of the Capacity Block offerings.

SELECT examples

Describes Capacity Block offerings available for purchase in the Amazon Web Services Region that you're currently using. With Capacity Blocks, you can purchase a specific GPU instance type or EC2 UltraServer for a period of time. To search for an available Capacity Block offering, you specify a reservation duration and instance count.

SELECT
availability_zone,
capacity_block_duration_hours,
capacity_block_duration_minutes,
capacity_block_offering_id,
currency_code,
end_date,
instance_count,
instance_type,
start_date,
tenancy,
ultraserver_count,
ultraserver_type,
upfront_fee,
zone_type
FROM aws.ec2.capacity_block_offerings
WHERE CapacityDurationHours = '{{ CapacityDurationHours }}' -- required
AND region = '{{ region }}' -- required
AND DryRun = '{{ DryRun }}'
AND InstanceType = '{{ InstanceType }}'
AND InstanceCount = '{{ InstanceCount }}'
AND StartDateRange = '{{ StartDateRange }}'
AND EndDateRange = '{{ EndDateRange }}'
AND NextToken = '{{ NextToken }}'
AND MaxResults = '{{ MaxResults }}'
AND UltraserverType = '{{ UltraserverType }}'
AND UltraserverCount = '{{ UltraserverCount }}'
AND AllAvailabilityZones = '{{ AllAvailabilityZones }}'
;

Lifecycle Methods

Purchase the Capacity Block for use with your account. With Capacity Blocks you ensure GPU capacity is available for machine learning (ML) workloads. You must specify the ID of the Capacity Block offering you are purchasing.

EXEC aws.ec2.capacity_block_offerings.purchase_capacity_block
@CapacityBlockOfferingId='{{ CapacityBlockOfferingId }}' --required,
@InstancePlatform='{{ InstancePlatform }}' --required,
@region='{{ region }}' --required,
@DryRun={{ DryRun }},
@TagSpecification='{{ TagSpecification }}'
;