Queries the price history of a preemptible instance within the previous 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. Default value: 1. Valid values:
Alibaba Cloud sends Elastic Compute Service (ECS) system events to notify you 5 minutes before the instance is released. Preemptible instances are billed by the second. We recommend that you specify a protection period based on your business requirements. Note If you set SpotStrategy to SpotWithPriceLimit or SpotAsPriceGo, this parameter takes effect. |
| 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 By default, this parameter is empty. This specifies that the time that is 3 hours earlier than the time specified by EndTime is used. |
| EndTime | String | No | 2017-08-22T08:45:08Z | The end time of the query. Specify the time in the ISO 8601 standard in the By default, this parameter is empty. This specifies that 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 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 line of the next page. It is the value of |
| SpotPrices | Array of SpotPriceType | The details of 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 follows the ISO 8601 standard 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
|
HttpCode |
Error code |
Error message |
Description |
| 400 | MissingParameter | %s | A required parameter is not specified. |
| 400 | UnsupportedParameter | %s | A specified parameter is not supported. |
| 400 | InvalidParameter | %s | Invalid parameter value. |
| 400 | InvalidInstanceID.Malformed | %s | Invalid InstanceId format. |
| 400 | InvalidParams.StartTime | %s | Invalid StartTime value. |
| 400 | InvalidParams.EndTime | %s | The specified EndTime parameter is invalid. |
| 400 | Abs.Abs.InvalidSpotInstanceUID | %s | The format of the preemptible instance ID is invalid. |
| 400 | InvalidParams.NetworkType | %s | Invalid NetworkType value. |
| 400 | InvalidParams.IoOptimized | %s | Invalid IoOptimized value. |
| 400 | InvalidParams.OSType | %s | The specified OSType parameter is invalid. |
| 400 | Abs.IoOptimized.ValueNotSupported | %s | The I/O optimization attribute of the instance is invalid. Check whether the specified IoOptimized value is valid. |
| 400 | InvalidZoneId.NotFound | The specified zone does not exist. | Invalid ZoneId value. |
| 400 | InvalidParams.ZoneId | %s | Invalid ZoneId value. |
| 400 | InvalidParams.RegionId | %s | Invalid RegionId value. |
| 400 | InvalidParams.InstanceType | %s | Invalid InstanceType value. |
| 400 | InvalidParams.PageSize | %s | Invalid PageSize value. |
| 400 | InvalidParams.Offset | %s | Invalid Offset value. |
| 400 | InvalidInstanceType.ValueNotSupported | %s | The instance type does not support this operation. |
| 400 | DependencyViolation.IoOptimized | The specified instancetype must be IoOptimized instance. | The specified instance type must be I/O optimized. |
| 400 | InvalidSpotDuration | The specified SpotDuration is not valid. | Invalid SpotDuration value. |
| 403 | InvalidUserType.NotSupported | %s | The account does not support this operation. |
| 403 | Abs.InvalidAccount.NotFound | %s | Your Alibaba Cloud account does not exist, or your AccessKey pair is expired. |
| 403 | Forbedden.NotSupportRAM | %s | Resource Access Management (RAM) users do not have the permissions to perform this operation. |
| 403 | Forbbiden.SubUser | %s | You do not have the permission to access the resource. Contact the owner of the Alibaba Cloud account to apply for the required permissions. |
For a list of error codes, see Service error codes.