All Products
Search
Document Center

Elastic Compute Service:DescribeAvailableResource

Last Updated:Jul 09, 2024

Queries resources in a zone. You can query the resources available in a zone before you create Elastic Compute Service (ECS) instances by calling the RunInstances operation or before you change instance types by calling the ModifyInstanceSpec operation.

Operation description

Usage notes

The value of DestinationResource determines whether you need to specify additional parameters. When you select a value in the following chain for DestinationResource, the more to the right the selected value is ordered, the more parameters you must specify.

  • Sequence: Zone > IoOptimized > InstanceType = Network = ddh > SystemDisk > DataDisk

  • Examples:

    • If you set DestinationResource to DataDisk, take note of the following items:

      • If you set ResourceType to disk to query the categories of data disks that are not attached to ECS instances, you do not need to specify InstanceType.
      • If you set ResourceType to instance to query the categories of data disks that are purchased together with ECS instances, you must specify InstanceType and SystemDiskCategory due to instance type-specific limits on system disks and data disks.
    • If you set DestinationResource to SystemDisk and ResourceType to instance, you must specify InstanceType due to instance type-specific limits on system disks.

    • If you set DestinationResource to InstanceType, we recommend that you specify IoOptimized and InstanceType.

    • If you want to query the available ecs.g5.large resources in all zones of the China (Hangzhou) region, set RegionId to cn-hangzhou, DestinationResource to InstanceType, IoOptimized to optimized, and InstanceType to ecs.g5.large.

    • If you want to query the zones where ecs.g5.large resources are available in the China (Hangzhou) region, set RegionId to cn-hangzhou, DestinationResource to Zone, IoOptimized to optimized, and InstanceType to ecs.g5.large.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The ID of the region for which to query resources. You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
InstanceChargeTypestringNo

The billing method of the resource. For more information, see Billing overview. Valid values:

  • PrePaid: subscription.
  • PostPaid: pay-as-you-go.

Default value: PostPaid.

PrePaid
SpotStrategystringNo

The bidding policy for pay-as-you-go instances. Valid values:

  • NoSpot: The instance is a pay-as-you-go instance.
  • SpotWithPriceLimit: The instance is a preemptible instance with a user-defined maximum hourly price.
  • SpotAsPriceGo: The instance is a preemptible instance for which the market price is automatically used as the bid price. The market price can be up to the pay-as-you-go price.

Default value: NoSpot.

The SpotStrategy parameter takes effect only when the InstanceChargeType parameter is set to PostPaid.

NoSpot
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 SpotStrategy is set to SpotWithPriceLimit or SpotAsPriceGo.
1
DestinationResourcestringYes

The resource type to query. Valid values:

  • Zone: zone.
  • IoOptimized: I/O optimized resource.
  • InstanceType: instance type.
  • SystemDisk: system disk.
  • DataDisk: data disk.
  • Network: network type.
  • ddh: dedicated host.

For more information about how to configure the DestinationResource parameter, see the Description section of this topic.

InstanceType
ZoneIdstringNo

The ID of the zone where the instance resides.

This parameter is empty by default. When this parameter is empty, the system returns resources that match the other criteria in all zones within the region specified by RegionId.

cn-hangzhou-e
IoOptimizedstringNo

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

  • none: The instance is a non-I/O optimized instance.
  • optimized: The instance is an I/O optimized instance.

Default value: optimized.

optimized
DedicatedHostIdstringNo

The ID of the dedicated host.

dh-bp165p6xk2tlw61e****
InstanceTypestringNo

The instance types. For more information, see Instance families or call the DescribeInstanceTypes operation to query the most recent instance type list.

For more information about how to configure the InstanceType parameter, see the Description section of this topic.

ecs.g5.large
SystemDiskCategorystringNo

The category of the system disk. Valid values:

  • cloud: basic disk
  • cloud_efficiency: ultra disk
  • cloud_ssd: standard SSD
  • ephemeral_ssd: local SSD
  • cloud_essd: Enterprise SSD (ESSD)
  • cloud_auto: ESSD AutoPL disk

Default value: cloud_efficiency.

Note This parameter must be specified when ResourceType is set to instance and DestinationResource is set to DataDisk. If you do not specify this parameter, the default value takes effect.
cloud_ssd
DataDiskCategorystringNo

The category of the data disk. Valid values:

  • cloud: basic disk
  • cloud_efficiency: ultra disk
  • cloud_ssd: standard SSD
  • ephemeral_ssd: local SSD
  • cloud_essd: ESSD
  • cloud_auto: ESSD AutoPL disk
cloud_ssd
NetworkCategorystringNo

The network type of the cluster. Valid values:

  • vpc
  • classic
vpc
CoresintegerNo

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

The Cores parameter takes effect only when the DestinationResource parameter is set to InstanceType.

2
MemoryfloatNo

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

The Memory parameter takes effect only when the DestinationResource parameter is set to InstanceType.

8.0
ResourceTypestringNo

The type of the resource. Valid values:

  • instance: ECS instance.
  • disk: cloud disk.
  • reservedinstance: reserved instance.
  • ddh: dedicated host.
instance
ScopestringNo

The scope of the reserved instance. Valid values:

  • Region: regional.
  • Zone: zonal.
Region

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

0041D94C-FB92-4C49-B115-259DA1C*****
AvailableZonesarray<object>

Details about the zones in which resources are available.

object

Details about the zones in which resources are available.

ZoneIdstring

The zone ID.

cn-hangzhou-e
Statusstring

The status of resources in the zone. Valid values:

  • Available
  • SoldOut
Available
StatusCategorystring

The resource category based on the stock level in the zone. Valid values:

  • WithStock: Resources are in sufficient stock.
  • ClosedWithStock: Resources are in insufficient stock. We recommend that you use other resources that are in sufficient stock.
  • WithoutStock: Resources are out of stock and will be replenished. We recommend that you use other resources that are in sufficient stock.
  • ClosedWithoutStock: Resources are out of stock and will not be replenished. We recommend that you use other resources that are in sufficient stock.
WithStock
RegionIdstring

The region ID.

cn-hangzhou
AvailableResourcesarray<object>

The resources that are available in the zone.

object

Details about the resources that can be created in the zone.

Typestring

The resource type. Valid values:

  • Zone: zone
  • IoOptimized: I/O optimized resource
  • InstanceType: instance type
  • SystemDisk: system disk
  • DataDisk: data disk
  • Network: network type
  • ddh: dedicated host
InstanceType
SupportedResourcesarray<object>

The information about the resources.

object

Details about the resources.

Statusstring

The status of the resource. Valid values:

  • Available
  • SoldOut
Available
Valuestring

The resource.

ecs.d1ne.xlarge
Maxinteger

The maximum disk capacity.

This parameter takes effect only if DestinationResource is set to SystemDisk or DataDisk.

2
Unitstring

The unit of the disk capacity.

This parameter takes effect only if DestinationResource is set to SystemDisk or DataDisk.

null
StatusCategorystring

The resource category based on the stock level. Valid values:

  • WithStock: Resources are in sufficient stock.
  • ClosedWithStock: Resources are in insufficient stock. We recommend that you use other resources that are in sufficient stock.
  • WithoutStock: Resources are out of stock and will be replenished. We recommend that you use other resources that are in sufficient stock.
  • ClosedWithoutStock: Resources are out of stock and will not be replenished. We recommend that you use other resources that are in sufficient stock.
WithStock
Mininteger

The minimum disk capacity.

This parameter takes effect only if DestinationResource is set to SystemDisk or DataDisk.

1

Examples

Sample success responses

JSONformat

{
  "RequestId": "0041D94C-FB92-4C49-B115-259DA1C*****",
  "AvailableZones": {
    "AvailableZone": [
      {
        "ZoneId": "cn-hangzhou-e",
        "Status": "Available",
        "StatusCategory": "WithStock",
        "RegionId": "cn-hangzhou",
        "AvailableResources": {
          "AvailableResource": [
            {
              "Type": "InstanceType",
              "SupportedResources": {
                "SupportedResource": [
                  {
                    "Status": "Available",
                    "Value": "ecs.d1ne.xlarge",
                    "Max": 2,
                    "Unit": "null",
                    "StatusCategory": "WithStock",
                    "Min": 1
                  }
                ]
              }
            }
          ]
        }
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400Invalid.InstanceChargeTypeThe specified InstanceChargeType is not valid.The specified InstanceChargeType parameter is invalid.
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.-
403InvalidParam.TypeAndCpuMem.ConflictThe specified 'InstanceType' and 'Cores','Memory' are not blank at the same time.-
403InvalidParam.CoresThe specified parameter 'Cores' should be empty-
403InvalidParam.MemoryThe specified parameter 'Memory' should be empty-
403InvalidParameter.ScopeThe specified parameter Scope is invalid.-
403OperationDenied.RegionIdNotSupportedregion not support spot duration instance.-
403OperationDenied.FlavorNotSupportedflavor not support spot duration instance.-
403OperationDenied.TimestampNotSupportedtimestamp not support spot duration instance.-
403InvalidParameter.ResourceOwnerIdThe specified parameter ResourceOwnerId is not available anymore.-
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.NetworkCategoryThe specified NetworkCategory is not valid.The specified NetworkCategory parameter is invalid.
404Invalid.SpotStrategyThe specified SpotStrategy is not valid.The specified SpotStrategy parameter is invalid.
404Invalid.NetworkTypeThe specified NetworkType is not valid.The specified NetworkType parameter is invalid.
404InvalidResourceId.NotFoundThe specified ResourceId is not found in our recordsThe specified ResourceId parameter is invalid. Check whether the resource exists.
404InvalidRegionId.NotFoundThe RegionId provided does not exist in our records.The RegionId provided does not exist

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

Change history

Change timeSummary of changesOperation
2024-03-25The Error code has changedView Change Details