Skip to main content

spot_price_histories

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

Overview

Namespot_price_histories
TypeResource
Idaws.ec2.spot_price_histories

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
availability_zonestringThe Availability Zone.
availability_zone_idstringThe ID of the Availability Zone.
instance_typestringThe instance type.
product_descriptionstringA general description of the AMI.
spot_pricestringThe maximum price per unit hour that you are willing to pay for a Spot Instance. We do not recommend using this parameter because it can lead to increased interruptions. If you do not specify this parameter, you will pay the current Spot price. If you specify a maximum price, your instances will be interrupted more frequently than if you do not specify this parameter.
timestampstringThe date and time the request was created, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ).

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_spot_price_historyselectregionAvailabilityZoneId, DryRun, StartTime, EndTime, InstanceType, ProductDescription, Filter, AvailabilityZone, MaxResults, NextTokenDescribes the Spot price history. For more information, see Spot Instance pricing history in the Amazon EC2 User Guide. When you specify a start and end time, the operation returns the prices of the instance types within that time range. It also returns the last price change before the start time, which is the effective price as of the start time.

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
regionstringAWS region (default: us-east-1)
AvailabilityZonestringFilters the results by the specified Availability Zone. Either AvailabilityZone or AvailabilityZoneId can be specified, but not both
AvailabilityZoneIdstringFilters the results by the specified ID of the Availability Zone. Either AvailabilityZone or AvailabilityZoneId can be specified, but not both
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.
EndTimestring (date-time)The date and time, up to the current date, from which to stop retrieving the price history data, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ).
FilterarrayThe filters. availability-zone - The Availability Zone for which prices should be returned. availability-zone-id - The ID of the Availability Zone for which prices should be returned. instance-type - The type of instance (for example, m3.medium). product-description - The product description for the Spot price (Linux/UNIX | Red Hat Enterprise Linux | SUSE Linux | Windows | Linux/UNIX (Amazon VPC) | Red Hat Enterprise Linux (Amazon VPC) | SUSE Linux (Amazon VPC) | Windows (Amazon VPC)). spot-price - The Spot price. The value must match exactly (or use wildcards; greater than or less than comparison is not supported). timestamp - The time stamp of the Spot price history, in UTC format (for example, ddd MMM dd HH:mm:ss UTC YYYY). You can use wildcards (* and ?). Greater than or less than comparison is not supported.
InstanceTypearrayFilters the results by the specified instance types.
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 returned from a previous paginated request. Pagination continues from the end of the items returned by the previous request.
ProductDescriptionarrayFilters the results by the specified basic product descriptions.
StartTimestring (date-time)The date and time, up to the past 90 days, from which to start retrieving the price history data, in UTC format (for example, YYYY-MM-DDTHH:MM:SSZ).

SELECT examples

Describes the Spot price history. For more information, see Spot Instance pricing history in the Amazon EC2 User Guide. When you specify a start and end time, the operation returns the prices of the instance types within that time range. It also returns the last price change before the start time, which is the effective price as of the start time.

SELECT
availability_zone,
availability_zone_id,
instance_type,
product_description,
spot_price,
timestamp
FROM aws.ec2.spot_price_histories
WHERE region = '{{ region }}' -- required
AND AvailabilityZoneId = '{{ AvailabilityZoneId }}'
AND DryRun = '{{ DryRun }}'
AND StartTime = '{{ StartTime }}'
AND EndTime = '{{ EndTime }}'
AND InstanceType = '{{ InstanceType }}'
AND ProductDescription = '{{ ProductDescription }}'
AND Filter = '{{ Filter }}'
AND AvailabilityZone = '{{ AvailabilityZone }}'
AND MaxResults = '{{ MaxResults }}'
AND NextToken = '{{ NextToken }}'
;