All Products
Search
Document Center

Elastic Compute Service:DescribeSpotAdvice

Last Updated:Dec 03, 2024

Queries information about preemptible instances in a region in the previous 30 days. The information includes the average release rate of preemptible instances and the percentage of the average preemptible instance price relative to the pay-as-you-go instance price.

Operation description

Usage notes

  • You can call this operation to query information about preemptible instances in the previous 30 days and select suitable instance types based on the query results. The information that you can query includes:

    • Average release rate of preemptible instances
    • Percentage of the average preemptible instance price relative to the pay-as-you-go instance price
    • Average preemptible instance price that is calculated based on the preceding percentage
  • This operation is applicable only to I/O optimized preemptible instances that reside in virtual private clouds (VPCs).

  • You can use one of the following methods to query information about preemptible instances in the previous 30 days:

    • Configure the Cores and Memory parameters or the MinCores and MinMemory parameters to query information about instance types that meet the specified vCPU and memory requirements.
    • Configure the InstanceTypes.N parameter to query information about specified instance types.
    • Configure the Cores and Memory parameters or the MinCores and MinMemory parameters and then configure the InstanceTypeFamily or InstanceFamilyLevel parameter to query information about instance types that meet the specified vCPU and memory requirements within the specified instance family or at a specified instance family level.

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 region ID. You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
CoresintegerNo

The number of vCPUs of the instance type. For more information, see Instance families.

2
MemoryfloatNo

The memory size of the instance type. Unit: GiB. For more information, see Instance families.

8.0
MinCoresintegerNo

The minimum number of vCPUs of the instance type. For more information, see Instance families.

2
MinMemoryfloatNo

The minimum memory size of the instance type. For more information, see Instance families.

8.0
ZoneIdstringNo

The zone ID.

This parameter is left empty by default, which indicates that all zones in the specified region are queried.

cn-hangzhou-i
InstanceTypeFamilystringNo

The instance family. For more information, see Instance families.

ecs.c5
InstanceFamilyLevelstringNo

The level of the instance family. Valid values:

This parameter is left empty by default, which indicates that instance families at all levels are queried.

EntryLevel
GpuSpecstringNo

The GPU type. Valid values:

  • NVIDIA P4
  • NVIDIA T4
  • NVIDIA P100
  • NVIDIA V100

This parameter is left empty by default, which indicates that all GPU types are queried. For more information, see GPU-accelerated compute-optimized and vGPU-accelerated instance families.

NVIDIA T4
GpuAmountintegerNo

The number of GPUs that a GPU-accelerated instance has. For information about the valid values, see GPU-accelerated compute optimized instance types.

2
InstanceTypesarrayNo

The instance types. You can specify up to 10 instance types.

stringNo

The instance type. For more information, see Instance families.

ecs.c5.large

Response parameters

ParameterTypeDescriptionExample
object
RegionIdstring

The region ID.

cn-hangzhou
RequestIdstring

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
AvailableSpotZonesarray<object>

Details about preemptible instances in the zones of the specified region.

Note The return values are sorted based on the historical percentages of average preemptible instance prices relative to pay-as-you-go instance prices for instance types.
AvailableSpotZoneobject
ZoneIdstring

The zone ID.

cn-hangzhou-i
AvailableSpotResourcesarray<object>

Details about preemptible instances in the previous 30 days, including the release rate of preemptible instances and percentages of average preemptible instance prices relative to pay-as-you-go instance prices.

AvailableSpotResourceobject
InterruptRateDescstring

The release rate range of preemptible instances in the previous 30 days, which corresponds to the InterruptionRate value. Valid values:

  • 0-3%
  • 3-5%
  • 5-10%
  • 10-100%
0-3%
AverageSpotDiscountinteger

The percentage of the average preemptible instance price relative to the pay-as-you-go instance price in the previous 30 days. Unit: %. Valid values: 1 to 100.

You can calculate the average preemptible instance price based on the return value. For example, if the pay-as-you-go instance price is 1 and the return value of this parameter is 20, the average preemptible instance price in the previous 30 days is 0.2.

20
InstanceTypestring

The instance type.

ecs.c5.large
InterruptionRatefloat

The average release rate of preemptible instances in the previous 30 days. Unit: %.

0

Examples

Sample success responses

JSONformat

{
  "RegionId": "cn-hangzhou",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
  "AvailableSpotZones": {
    "AvailableSpotZone": [
      {
        "ZoneId": "cn-hangzhou-i",
        "AvailableSpotResources": {
          "AvailableSpotResource": [
            {
              "InterruptRateDesc": "0-3%",
              "AverageSpotDiscount": 20,
              "InstanceType": "ecs.c5.large",
              "InterruptionRate": 0
            }
          ]
        }
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400Invalid.SaleStrategyThe specified saleStrategy is not valid.-
400Invalid.ParamThe input parameter DestinationResource that is mandatory for processing this request is not supplied.The specified DestinationResource parameter is invalid.
400InvalidRegionId.MalFormedThe specified parameter RegionId is not valid.The specified RegionId parameter is invalid.
403InvalidDedicatedHostId.NotFoundThe specified DedicatedHostId does not exist in our records.-
403InvalidParam.TypeAndCpuMem.ConflictThe specified 'InstanceType' and 'Cores','Memory' are not blank at the same time.-
403InvalidParam.CoresThe specified parameter 'Cores' should not be empty-
403InvalidParam.MemoryThe specified parameter 'Memory' should not be empty-
403OperationDenied.RegionIdNotSupportedregion not support spot duration instance.-
403OperationDenied.FlavorNotSupportedflavor not support spot duration instance.-
403OperationDenied.TimestampNotSupportedtimestamp not support spot duration instance.-
404Invalid.RegionIdThe specified RegionId does not exist.The specified RegionId parameter is invalid.
404Unavailable.RegionsThe available regions does not existsThe specified RegionId parameter is invalid.
404Invalid.ResourceTypeThe ResourceType provided does not exist in our records.The specified resource type is invalid.
404Invalid.DestinationResourceThe specified DestinationResource is not valid.The specified DestinationResource parameter is invalid.
404Invalid.IoOptimizedThe specified IoOptimized is not valid.The specified IoOptimized parameter is invalid.
404Invalid.NetworkTypeThe specified NetworkType is not valid.The specified NetworkType parameter is invalid.

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

Change history

Change timeSummary of changesOperation
No change history