Queries the historical prices of spot instances. You can retrieve data from the last 30 days. The historical price data helps you set a reasonable maximum price per spot instance.
Operation description
Only I/O optimized spot instances are supported.
The returned data may be paginated. If the response includes the
NextOffsetparameter, you can set theOffsetrequest parameter to theNextOffsetvalue to query subsequent data.
Try it now
Test
RAM authorization
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID of the instance. You can call DescribeRegions to query the most recent region list. |
cn-hangzhou |
| ZoneId |
string |
No |
The zone ID. |
cn-hangzhou-g |
| NetworkType |
string |
Yes |
The network type of the spot instance. Valid values:
|
vpc |
| InstanceType |
string |
Yes |
The instance type. |
ecs.t1.xsmall |
| SpotDuration |
integer |
No |
The protection period of the spot instance. Unit: hours. Default value: 1. Valid values:
Alibaba Cloud sends you a notification through an ECS system event 5 minutes before the instance is revoked. Spot instances are billed by the second. Select an appropriate protection period based on the execution duration of specific tasks. Note
This parameter takes effect only when SpotStrategy is set to SpotWithPriceLimit or SpotAsPriceGo. |
1 |
| IoOptimized |
string |
No |
Specifies whether the spot instance is an I/O optimized instance. Valid values:
Default value for Generation I instances: none. Default value for other instance family types: optimized. |
optimized |
| StartTime |
string |
No |
The start time to query the historical prices of spot instances. The time span between the start time and the specified end time cannot exceed 30 days. Specify the time in the ISO 8601 standard in the Default value: empty. An empty value indicates 3 hours before the end time. |
2017-08-22T08:45:08Z |
| EndTime |
string |
No |
The end time to query the historical prices of spot instances. Specify the time in the ISO 8601 standard in the Default value: empty. An empty value indicates the current time. |
2017-08-22T08:45:08Z |
| OSType |
string |
No |
The operating system platform of the instance. Valid values:
|
linux |
| Offset |
integer |
No |
The starting row for the query. Default value: 0. |
0 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
| Currency |
string |
The currency unit of the price. China site: CNY. International site: USD. |
CNY |
| NextOffset |
integer |
The starting row of the next page. You can use this value to query the next page of data by setting the |
1000 |
| SpotPrices |
object |
||
| SpotPriceType |
array<object> |
The details of the spot prices. |
|
|
object |
|||
| IoOptimized |
string |
Indicates whether the spot instance is an I/O optimized instance. |
optimized |
| ZoneId |
string |
The zone ID of the spot instance. |
cn-hangzhou-c |
| SpotPrice |
number |
The price of the spot instance. |
0.036 |
| Timestamp |
string |
The timestamp of the price in the |
2019-11-19T06:00:00Z |
| NetworkType |
string |
The network type of the spot instance. |
vpc |
| InstanceType |
string |
The instance type of the spot instance. |
ecs.g5.large |
| OriginPrice |
number |
The original price of the pay-as-you-go instance. |
0.354 |
Examples
Success response
JSON format
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
"Currency": "CNY",
"NextOffset": 1000,
"SpotPrices": {
"SpotPriceType": [
{
"IoOptimized": "optimized",
"ZoneId": "cn-hangzhou-c",
"SpotPrice": 0.036,
"Timestamp": "2019-11-19T06:00:00Z",
"NetworkType": "vpc",
"InstanceType": "ecs.g5.large",
"OriginPrice": 0.354
}
]
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | MissingParameter | %s | A parameter is not specified. |
| 400 | UnsupportedParameter | %s | The parameter is not supported. |
| 400 | InvalidParameter | %s | The specified parameter is invalid. |
| 400 | InvalidInstanceID.Malformed | %s | The specified InstanceId parameter is invalid. |
| 400 | InvalidParams.StartTime | %s | The specified StartTime parameter is invalid. |
| 400 | InvalidParams.EndTime | %s | The specified EndTime parameter is invalid. |
| 400 | Abs.Abs.InvalidSpotInstanceUID | %s | The preemptible instance ID is invalid. |
| 400 | InvalidParams.NetworkType | %s | The specified NetworkType parameter is invalid. |
| 400 | InvalidParams.IoOptimized | %s | The specified IoOptimized parameter is invalid. |
| 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 parameter is valid. |
| 400 | InvalidZoneId.NotFound | The specified zone does not exist. | The specified zone ID does not exist. |
| 400 | InvalidParams.ZoneId | %s | The specified ZoneId parameter is invalid. |
| 400 | InvalidParams.RegionId | %s | The specified RegionId parameter is invalid. |
| 400 | InvalidParams.InstanceType | %s | The specified InstanceType parameter is invalid. |
| 400 | InvalidParams.PageSize | %s | The specified PageSize parameter is invalid. |
| 400 | InvalidParams.Offset | %s | The specified Offset parameter is invalid. |
| 400 | InvalidInstanceType.ValueNotSupported | %s | The operation is not supported by the specified instance type. |
| 400 | DependencyViolation.IoOptimized | The specified instancetype must be IoOptimized instance. | The specified instance type must be I/O optimized. Check your instance type and try again. |
| 400 | InvalidSpotDuration | The specified SpotDuration is not valid. | The specified SpotDuration parameter is invalid. |
| 400 | OperationDenied.QueryFail | Query spot price fail, please retry later. | |
| 403 | InvalidUserType.NotSupported | %s | Your account does not support this operation. |
| 403 | Abs.InvalidAccount.NotFound | %s | Your Alibaba Cloud account does not exist or your AccessKey pair has expired. |
| 403 | Forbedden.NotSupportRAM | %s | RAM users are not authorized to perform this operation. |
| 403 | Forbbiden.SubUser | %s | You are not authorized to manage this resource. Contact the owner of the Alibaba Cloud account for authorization. |
| 403 | OperationDenied.RegionIdNotSupported | region not support spot duration instance. | |
| 403 | OperationDenied.FlavorNotSupported | flavor not support spot duration instance. | |
| 403 | OperationDenied.TimestampNotSupported | timestamp not support spot duration instance. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.