Queries the price history of a preemptible instance over the last 30 days.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | DescribeSpotPriceHistory | The operation that you want to perform. Set the value to DescribeSpotPriceHistory. |
RegionId | String | Yes | cn-hangzhou | The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list. |
ZoneId | String | No | cn-hangzhou-g | The zone ID of the instance. |
NetworkType | String | Yes | vpc | The network type of the preemptible instance. Valid values:
|
InstanceType | String | Yes | ecs.t1.xsmall | The instance type of the instance. |
SpotDuration | Integer | No | 1 | The protection period of the preemptible instance. Unit: hours. Valid values: 0, 1, 2, 3, 4, 5, and 6.
Default value: 1. |
IoOptimized | String | No | optimized | Specifies whether the instance is I/O optimized. Valid values:
For generation I instance families, the default value is none. For other instance families, the default value is optimized. |
StartTime | String | No | 2017-08-22T08:45:08Z | The beginning of the time range to query. Specify the time in the ISO 8601 standard in the This parameter is empty by default. If this parameter is empty, it indicates 3 hours earlier than the specified EndTime value. You can specify a StartTime value of up to 30 days earlier than the specified EndTime value. |
EndTime | String | No | 2017-08-22T08:45:08Z | The end of the time range to query. Specify the time in the ISO 8601 standard in the This parameter is empty by default. If this parameter is empty, the current time is used. |
OSType | String | No | linux | The type of the operating system platform. Valid values:
|
Offset | Integer | No | 0 | The line from which the next query starts. Default value: 0. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E | The ID of the request. |
Currency | String | CNY | The currency unit of the price. Alibaba Cloud China site (aliyun.com): CNY. Alibaba Cloud International site (alibabacloud.com): USD. |
NextOffset | Integer | 1000 | The start row of the next page. It is the value of the |
SpotPrices | Array of SpotPriceType | Details about the spot prices. | |
SpotPriceType | |||
IoOptimized | String | optimized | Indicates whether the preemptible instance is I/O optimized. |
ZoneId | String | cn-hangzhou-c | The zone ID of the preemptible instance. |
SpotPrice | Float | 0.036 | The spot price of the preemptible instance. |
Timestamp | String | 2019-11-19T06:00:00Z | The time that corresponds to the queried spot price. The time is in the |
NetworkType | String | vpc | The network type of the preemptible instance. |
InstanceType | String | ecs.g5.large | The instance type of the preemptible instance. |
OriginPrice | Float | 0.354 | The price for a pay-as-you-go instance that has the same configuration as the specified preemptible instance. |
Examples
Sample requests
https://ecs.aliyuncs.com/?Action=DescribeSpotPriceHistory
&NetworkType=vpc
&RegionId=cn-hangzhou
&InstanceType=ecs.g5.large
&StartTime=2019-11-19T00:00:00Z
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<DescribeSpotPriceHistoryResponse>
<RequestId>5E2D59BA-4EB0-45C4-A0D7-D98C1A4B320B</RequestId>
<SpotPrices>
<SpotPriceType>
<IoOptimized>optimized</IoOptimized>
<OriginPrice>0.354</OriginPrice>
<NetworkType>vpc</NetworkType>
<ZoneId>cn-hangzhou-g</ZoneId>
<Timestamp>2019-11-19T06:00:00Z</Timestamp>
<SpotPrice>0.036</SpotPrice>
<InstanceType>ecs.g5.large</InstanceType>
</SpotPriceType>
<SpotPriceType>
<IoOptimized>optimized</IoOptimized>
<OriginPrice>0.354</OriginPrice>
<NetworkType>vpc</NetworkType>
<ZoneId>cn-hangzhou-g</ZoneId>
<Timestamp>2019-11-19T07:00:00Z</Timestamp>
<SpotPrice>0.036</SpotPrice>
<InstanceType>ecs.g5.large</InstanceType>
</SpotPriceType>
</SpotPrices>
<Currency>CNY</Currency>
</DescribeSpotPriceHistoryResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "5E2D59BA-4EB0-45C4-A0D7-D98C1A4B320B",
"SpotPrices" : {
"SpotPriceType" : [ {
"IoOptimized" : "optimized",
"OriginPrice" : 0.354,
"NetworkType" : "vpc",
"ZoneId" : "cn-hangzhou-g",
"Timestamp" : "2019-11-19T06:00:00Z",
"SpotPrice" : 0.036,
"InstanceType" : "ecs.g5.large"
}, {
"IoOptimized" : "optimized",
"OriginPrice" : 0.354,
"NetworkType" : "vpc",
"ZoneId" : "cn-hangzhou-g",
"Timestamp" : "2019-11-19T07:00:00Z",
"SpotPrice" : 0.036,
"InstanceType" : "ecs.g5.large"
} ]
},
"Currency" : "CNY"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | MissingParameter | %s | The error message returned because a required parameter is not specified. |
400 | UnsupportedParameter | %s | The error message returned because a specified parameter is not supported. |
400 | InvalidParameter | %s | The error message returned because a specified parameter is invalid. |
400 | InvalidInstanceID.Malformed | %s | The error message returned because the specified InstanceId parameter is invalid. |
400 | InvalidParams.StartTime | %s | The error message returned because the specified StartTime parameter is invalid. |
400 | InvalidParams.EndTime | %s | The error message returned because the specified EndTime parameter is invalid. |
400 | Abs.Abs.InvalidSpotInstanceUID | %s | The error message returned because the format of the preemptible instance ID is invalid. |
400 | InvalidParams.NetworkType | %s | The error message returned because the specified NetworkType parameter is invalid. |
400 | InvalidParams.IoOptimized | %s | The error message returned because the specified IoOptimized parameter is invalid. |
400 | InvalidParams.OSType | %s | The error message returned because the specified OSType parameter is invalid. |
400 | Abs.IoOptimized.ValueNotSupported | %s | The error message returned because the specified IoOptimized parameter is invalid. |
400 | InvalidZoneId.NotFound | The specified zone does not exist. | The error message returned because the specified ZoneId parameter does not exist. |
400 | InvalidParams.ZoneId | %s | The error message returned because the specified ZoneId parameter is invalid. |
400 | InvalidParams.RegionId | %s | The error message returned because the specified RegionId parameter is invalid. |
400 | InvalidParams.InstanceType | %s | The error message returned because the specified InstanceType parameter is invalid. |
400 | InvalidParams.PageSize | %s | The error message returned because the specified PageSize parameter is invalid. |
400 | InvalidParams.Offset | %s | The error message returned because the specified Offset parameter is invalid. |
400 | InvalidInstanceType.ValueNotSupported | %s | The error message returned because the operation is not supported by the specified instance type. |
400 | DependencyViolation.IoOptimized | The specified instancetype must be IoOptimized instance. | The error message returned because the specified instance type is not I/O optimized. |
400 | InvalidSpotDuration | The specified SpotDuration is not valid. | The error message returned because the specified SpotDuration parameter is invalid. |
403 | InvalidUserType.NotSupported | %s | The error message returned because your account does not support this operation. |
403 | Abs.InvalidAccount.NotFound | %s | The error message returned because your Alibaba Cloud account does not exist or because your AccessKey pair has expired. |
403 | Forbedden.NotSupportRAM | %s | The error message returned because RAM users are not authorized to perform this operation. |
403 | Forbidden.SubUser | %s | The error message returned because you are not authorized to manage this resource. Contact the owner of the Alibaba Cloud account for authorization. |
For a list of error codes, visit the API Error Center.