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 conceptual information about Spot Instances, refer to the Amazon Elastic Compute
Cloud Developer Guide or Amazon Elastic Compute Cloud
User Guide.
Access
Parameters
Parameter |
Type |
Required |
Description |
$opt
|
array
|
Optional
|
An associative array of parameters that can have the following keys:
StartTime - string - Optional - The start date and time of the Spot Instance price history data. May be passed as a number of seconds since UNIX Epoch, or any string compatible with strtotime() .EndTime - string - Optional - The end date and time of the Spot Instance price history data. May be passed as a number of seconds since UNIX Epoch, or any string compatible with strtotime() .InstanceType - string|array - Optional - Specifies the instance type to return. Pass a string for a single value, or an indexed array for multiple values.ProductDescription - string|array - Optional - The description of the AMI. Pass a string for a single value, or an indexed array for multiple values.Filter - array - Optional - A list of filters used to match properties for SpotPriceHistory. For a complete reference to the available filter keys for this operation, see the Amazon EC2 API reference. x - array - Optional - This represents a simple array index. Name - string - Optional - Specifies the name of the filter.Value - string|array - Optional - Contains one or more values for the filter. Pass a string for a single value, or an indexed array for multiple values.
AvailabilityZone - string - Optional - Filters the results by availability zone (ex: ‘us-east-1a’).MaxResults - integer - Optional - Specifies the number of rows to return.NextToken - string - Optional - Specifies the next set of rows to return.curlopts - array - Optional - A set of values to pass directly into curl_setopt() , where the key is a pre-defined CURLOPT_* constant.returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests. |
Returns
Examples
Describe spot price history.
$ec2 = new AmazonEC2();
$response = $ec2->describe_spot_price_history(array(
'StartTime' => '3 months ago',
'EndTime' => 'yesterday, 9am',
'InstanceType' => array(
'm1.small',
'c1.medium'
),
'ProductDescription' => 'Linux/UNIX'
));
var_dump($response->isOK());
Result:
bool(true)
Filter spot price history.
$ec2 = new AmazonEC2();
$response = $ec2->describe_spot_price_history(array(
'Filter' => array(
array('Name' => 'product-description', 'Value' => 'Linux/UNIX'),
array('Name' => 'instance-type', 'Value' => 't1.micro' ),
)
));
var_dump($response->isOK());
Result:
bool(true)
Related Methods
Source
Method defined in services/ec2.class.php | Toggle source view (45 lines) | View on GitHub
public function describe_spot_price_history($opt = null)
{
if (!$opt) $opt = array();
// Optional DateTime
if (isset($opt['StartTime']))
{
$opt['StartTime'] = $this->util->convert_date_to_iso8601($opt['StartTime']);
}
// Optional DateTime
if (isset($opt['EndTime']))
{
$opt['EndTime'] = $this->util->convert_date_to_iso8601($opt['EndTime']);
}
// Optional list (non-map)
if (isset($opt['InstanceType']))
{
$opt = array_merge($opt, CFComplexType::map(array(
'InstanceType' => (is_array($opt['InstanceType']) ? $opt['InstanceType'] : array($opt['InstanceType']))
)));
unset($opt['InstanceType']);
}
// Optional list (non-map)
if (isset($opt['ProductDescription']))
{
$opt = array_merge($opt, CFComplexType::map(array(
'ProductDescription' => (is_array($opt['ProductDescription']) ? $opt['ProductDescription'] : array($opt['ProductDescription']))
)));
unset($opt['ProductDescription']);
}
// Optional list + map
if (isset($opt['Filter']))
{
$opt = array_merge($opt, CFComplexType::map(array(
'Filter' => $opt['Filter']
)));
unset($opt['Filter']);
}
return $this->authenticate('DescribeSpotPriceHistory', $opt);
}