Amazon Elastic Compute Cloud
API Reference (API Version 2013-02-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

DescribeSpotPriceHistory

Description

Describes the Spot Price history. Spot Instances are instances that Amazon EC2 starts on your behalf when the maximum price that you specify exceeds the current Spot Price. Amazon EC2 periodically sets the Spot Price based on available Spot Instance capacity and current Spot Instance requests. For more information about Spot Instances, see Spot Instances in the Amazon Elastic Compute Cloud User Guide.

When you use the availability-zone option, this command describes the price history for the specified Availability Zone with the most recent set of prices listed first. If you don't specify an Availability Zone, the command returns the prices across all Availability Zones, starting with the most recent set. However, if you use this command with versions of the API earlier than the 2011-05-15 version, this command returns the lowest price across the region for the given time period. The prices returned are listed in chronological order — from the oldest to the most recent.

Request Parameters

StartTime

The start date and time of the Spot Instance price history data.

Type: DateTime

Default: None

Required: No

EndTime

The end date and time of the Spot Instance price history data.

Type: DateTime

Default: None

Required: No

InstanceType.n

The instance type to return.

Type: String

Valid values: t1.micro | m1.small | m1.medium | m1.large | m1.xlarge | m3.xlarge | m3.2xlarge | c1.medium | c1.xlarge | m2.xlarge | m2.2xlarge | m2.4xlarge | cr1.8xlarge | cc1.4xlarge | cc2.8xlarge | cg1.4xlarge. See Available Instance Types for more information.

Default: None

Required: No

ProductDescription.n

Filters the results by basic product description.

Type: String

Valid values: Linux/UNIX | SUSE Linux | Windows | Linux/UNIX (Amazon VPC) | SUSE Linux (Amazon VPC) | Windows (Amazon VPC)

Default: Returns all information

Required: No

Filter.n.Name

The name of a filter. See the Supported Filters section for a list of supported filter names.

Type: String

Default: None

Required: No

Filter.n.Value.m

A value for the filter. See the Supported Filters section for a list of supported values for each filter.

Type: String

Default: None

Required: No

AvailabilityZone

Filters the results by availability zone.

Type: String

Valid values: us-east-1a, etc.

Default: None

Required: No

MaxResults

The number of rows to return.

Type: Integer

Default: None

Required: No

NextToken

The next set of rows to return.

Type: String

Valid values: A NextToken value returned by a previous call of the API.

Default: None

Required: No

Supported Filters

Note

Our policy is to provide filters for all ec2-describe calls so you can limit the response to your specified criteria. Therefore, you can use filters to limit the response when describing Spot Price histories, even though you can use the options instead.

For example, you could use an option or a filter to get the history for a particular instance type. You can specify multiple request parameters or filters (for example, limit the response to the m2.xlarge instance type, and only for Windows instances). The response includes information for a price history only if it matches all your options or filters. If there's no match, no special message is returned, the response is simply empty.

You can use wildcards in a filter value. An asterisk (*) matches zero or more characters, and a question mark (?) matches exactly one character. You can escape special characters using a backslash (\) before the character. For example, a value of \*amazon\?\\ searches for the literal string *amazon?\.

The following are the available filters.

instance-type

The type of instance (for example, m1.small).

Type: String

product-description

The product description for the Spot Price.

Type: String

Valid values: Linux/UNIX | SUSE Linux | Windows | Linux/UNIX (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).

Type: String

timestamp

The timestamp of the Spot Price history (for example, 2010-08-16T05:06:11.000Z). You can use wildcards (* and ?). Greater than or less than comparison is not supported.

Type: DateTime

availability-zone

The Availability Zone for which prices should be returned.

Type: String

Response Elements

The following elements are returned in a DescribeSpotPriceHistoryResponse element.

requestId

The ID of the request.

Type: xsd:string

spotPriceHistorySet

A list of historical Spot Prices. Each price is wrapped in an item element.

Type: SpotPriceHistorySetItemType

nextToken

The string marking the next set of results returned. Displays empty if there are no more results to be returned.

Type: xsd:string

Examples

Example Request

This example returns Spot Price history for a particular day in December 2009 for Availability Zone us-east-1a.

https://ec2.amazonaws.com/?Action=DescribeSpotPriceHistory
&StartTime=2009-12-04T00:00:00.000Z
&EndTime=2009-12-04T23:59:59.000Z
&AvailabilityZone=us-east-1a
&AUTHPARAMS

This request uses filters instead of regular request parameters to achieve the same results.

https://ec2.amazonaws.com/?Action=DescribeSpotPriceHistory
&Filter.1.Name=timestamp
&Filter.1.Value.1=2009-12-04*
&Filter.2.Name=availability-zone
&Filter.2.Value.1=us-east-1a
&AUTHPARAMS

Example Response

<DescribeSpotPriceHistoryResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-01/">
   <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> 
   <spotPriceHistorySet>
      <item>
         <instanceType>m1.small</instanceType>
         <productDescription>Linux/UNIX</productDescription>
         <spotPrice>0.287</spotPrice>
         <timestamp>2009-12-04T20:56:05.000Z</timestamp>
         <availabilityZone>us-east-1a</availabilityZone>
      </item>
      <item>
         <instanceType>m1.small</instanceType>
         <productDescription>Windows</productDescription>
         <spotPrice>0.033</spotPrice>
         <timestamp>2009-12-04T22:33:47.000Z</timestamp>
         <availabilityZone>us-east-1a</availabilityZone>
      </item>
   </spotPriceHistorySet>
   <nextToken/>
</DescribeSpotPriceHistoryResponse>