All Products
Search
Document Center

Elastic Compute Service:DescribeSpotPriceHistory

更新時間:Dec 24, 2024

Queries the historical prices of preemptible instances within the previous 30 days.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The zone ID of the preemptible instance.

cn-hangzhou
ZoneIdstringNo

The spot price (market price) of the preemptible instance.

cn-hangzhou-g
NetworkTypestringYes

The network type of the preemptible instance. Valid values:

  • classic: classic network
  • vpc: Virtual Private Cloud (VPC)
vpc
InstanceTypestringYes

The beginning of the time range to query. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC. The specified time can be up to 30 days earlier than the specified EndTime value.

This parameter is empty by default. If this parameter is empty, the time that is 3 hours earlier than the specified EndTime value is used.

ecs.t1.xsmall
SpotDurationintegerNo

The protection period of the preemptible instance. Unit: hours. Default value: 1. Valid values:

  • 1: After a preemptible instance is created, Alibaba Cloud ensures that the instance is not automatically released within 1 hour. After the 1-hour protection period ends, the system compares the bid price with the market price and checks the resource inventory to determine whether to retain or release the instance.
  • 0: After a preemptible instance is created, Alibaba Cloud does not ensure that the instance runs for 1 hour. The system compares the bid price with the market price and checks the resource inventory to determine whether to retain or release the instance.

Alibaba Cloud sends an ECS system event to notify you 5 minutes before the instance is released. Preemptible instances are billed by second. We recommend that you specify a protection period based on your business requirements.

Note This parameter takes effect only if you set SpotStrategy to SpotWithPriceLimit or SpotAsPriceGo.
1
IoOptimizedstringNo

Specifies whether the instance is I/O optimized. Valid values:

  • optimized: The instance is I/O optimized.
  • none: The instance is not I/O optimized.

For instances of generation I instance families, the default value is none.

For instances of other instance families, the default value is optimized.

optimized
StartTimestringNo

The beginning of the time range to query. The value of this parameter and the value of EndTime can be up to 30 days apart. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

This parameter is left empty by default. If this parameter is empty, the time that is 3 hours earlier than the value of EndTime is used.

2017-08-22T08:45:08Z
EndTimestringNo

The end of the time range to query. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

This parameter is empty by default. If this parameter is empty, the current time is used.

2017-08-22T08:45:08Z
OSTypestringNo

The type of the operating system platform. Valid values:

  • linux
  • windows
linux
OffsetintegerNo

The line from which the query starts.

Default value: 0

0

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The instance type of the preemptible instance.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
Currencystring

The instance type of the preemptible instance.

CNY
NextOffsetinteger

The network type of the preemptible instance.

1000
SpotPricesarray<object>

The zone ID of the preemptible instance.

SpotPriceTypeobject
IoOptimizedstring

Details about the price history of the preemptible instance.

optimized
ZoneIdstring

The ID of the request.

cn-hangzhou-c
SpotPricefloat

The price for a pay-as-you-go instance that has the same configurations as the preemptible instance.

0.036
Timestampstring

The currency unit of the price.

Alibaba Cloud China site (aliyun.com): CNY.

Alibaba Cloud International site (alibabacloud.com): USD.

2019-11-19T06:00:00Z
NetworkTypestring

Queries the price history of a preemptible instance within the last 30 days.

vpc
InstanceTypestring

The instance type of the preemptible instance.

ecs.g5.large
OriginPricefloat

The price for a pay-as-you-go instance that has the same configuration as the specified preemptible instance.

0.354

Examples

Sample success responses

JSONformat

{
  "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 codeError codeError messageDescription
400MissingParameter%sA parameter is not specified.
400UnsupportedParameter%sThe parameter is not supported.
400InvalidParameter%sThe specified parameter is invalid.
400InvalidInstanceID.Malformed%sThe specified InstanceId parameter is invalid.
400InvalidParams.StartTime%sThe specified StartTime parameter is invalid.
400InvalidParams.EndTime%sThe specified EndTime parameter is invalid.
400Abs.Abs.InvalidSpotInstanceUID%sThe preemptible instance ID is invalid.
400InvalidParams.NetworkType%sThe specified NetworkType parameter is invalid.
400InvalidParams.IoOptimized%sThe specified IoOptimized parameter is invalid.
400InvalidParams.OSType%sThe specified OSType parameter is invalid.
400Abs.IoOptimized.ValueNotSupported%sThe I/O optimization attribute of the instance is invalid. Check whether the specified IoOptimized parameter is valid.
400InvalidZoneId.NotFoundThe specified zone does not exist.The specified zone ID does not exist.
400InvalidParams.ZoneId%sThe specified ZoneId parameter is invalid.
400InvalidParams.RegionId%sThe specified RegionId parameter is invalid.
400InvalidParams.InstanceType%sThe specified InstanceType parameter is invalid.
400InvalidParams.PageSize%sThe specified PageSize parameter is invalid.
400InvalidParams.Offset%sThe specified Offset parameter is invalid.
400InvalidInstanceType.ValueNotSupported%sThe operation is not supported by the specified instance type.
400DependencyViolation.IoOptimizedThe specified instancetype must be IoOptimized instance.The specified instance type must be I/O optimized. Check your instance type and try again.
400InvalidSpotDurationThe specified SpotDuration is not valid.The specified SpotDuration parameter is invalid.
400OperationDenied.QueryFailQuery spot price fail, please retry later.-
403InvalidUserType.NotSupported%sYour account does not support this operation.
403Abs.InvalidAccount.NotFound%sYour Alibaba Cloud account does not exist or your AccessKey pair has expired.
403Forbedden.NotSupportRAM%sRAM users are not authorized to perform this operation.
403Forbbiden.SubUser%sYou are not authorized to manage this resource. Contact the owner of the Alibaba Cloud account for authorization.
403OperationDenied.RegionIdNotSupportedregion not support spot duration instance.-
403OperationDenied.FlavorNotSupportedflavor not support spot duration instance.-
403OperationDenied.TimestampNotSupportedtimestamp not support spot duration instance.-

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history