Queries resources in a zone. For example, you can query the resources available in a zone before you create ECS instances by calling the RunInstances operation or before you modify instance types by calling the ModifyInstanceSpec operation.

Description

Values for the DestinationResource parameter have dependencies. When you select a value in the following chain for the DestinationResource parameter, 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, you must specify the InstanceType parameter or set the ResourceType parameter to disk.
    • If you set DestinationResource to SystemDisk, you must specify the InstanceType parameter.
    • If you set DestinationResource to InstanceType, you must specify the IoOptimized and InstanceType parameters.
    • If you want to query which zones in the China (Hangzhou) region have ecs.g5.large resources available, you must set RegionId to cn-hangzhou, DestinationResource to InstanceType, IoOptimized to optimized, and InstanceType to ecs.g5.large.
    • If you want to query which zones in the China (Hangzhou) region have ecs.g5.large resources available, you must 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. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeAvailableResource

The operation that you want to perform. Set the value to DescribeAvailableResource.

RegionId String Yes cn-hangzhou

The region ID. You can call the DescribeRegions operation to query the most recent region list.

InstanceChargeType String No PrePaid

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

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

Default value: PostPaid.

SpotStrategy String No NoSpot

The preemption policy for the pay-as-you-go instance. Valid values:

  • NoSpot: applies to regular pay-as-you-go instances.
  • SpotWithPriceLimit: applies to preemptible instances that have maximum hourly prices.
  • SpotAsPriceGo: applies to preemptible instances that are of the market price at the time of purchase.

Default value: NoSpot.

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

DestinationResource String Yes InstanceType

The resource type to query. Valid values:

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

For more information about how to set the DestinationResource parameter, see the "Description" section in this topic.

ZoneId String No cn-hangzhou-e

The ID of the zone for which to query resources.

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

IoOptimized String No optimized

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

  • none: non-I/O optimized
  • optimized: I/O optimized

Default value: optimized

DedicatedHostId String No dh-bp165p6xk2tlw61e****

The ID of the dedicated host.

InstanceType String No ecs.g5.large

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

When the DestinationResource parameter is set to SystemDisk or DataDisk, you must set the InstanceType parameter.

SystemDiskCategory String No cloud_ssd

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: enhanced SSD (ESSD)

Default value: cloud_efficiency.

Note When the ResourceType parameter is set to instance and the DestinationResource parameter is set to DataDisk, you must set the SystemDiskCategory parameter. If you do not set this parameter, the default value takes effect.
DataDiskCategory String No cloud_ssd

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
NetworkCategory String No vpc

The network type. Valid values:

  • vpc
  • classic
Cores Integer No 2

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

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

Memory Float No 8.0

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.

ResourceType String No instance

The type of the resource. Valid values:

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

Response parameters

Parameter Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

AvailableZones Array of AvailableZone

An array consisting of zones.

AvailableZone
ZoneId String cn-hangzhou-e

The zone ID of the resource.

Status String Available

The status of the resource. Valid values:

  • Available
  • SoldOut
StatusCategory String WithStock

The resource category based on the stock. Valid values:

  • WithStock: Resources are in sufficient stock.
  • ClosedWithStock: Resources are insufficient. We recommend that you use other resources that are in sufficient stock.
  • WithoutStock: Resources are sold out and will be replenished. We recommend that you use other resources that are in sufficient stock.
  • ClosedWithoutStock: Resources are sold out and will not be replenished. We recommend that you use other resources that are in sufficient stock.
RegionId String cn-hangzhou

The region ID of the resource.

AvailableResources Array of AvailableResource

An array consisting of available resource types.

AvailableResource
Type String InstanceType

The type of the resource. Valid values:

  • Zone: zone
  • IoOptimized: I/O optimized
  • InstanceType: instance type
  • SystemDisk: system disk
  • DataDisk: data disk
  • Network: network type
  • ddh: dedicated host
SupportedResources Array of SupportedResource

An array consisting of supported resource types.

SupportedResource
Status String Available

The status of the resource. Valid values:

  • Available
  • SoldOut
Value String ecs.d1ne.xlarge

The resource type.

Max Integer 2

The maximum number of available resources of a specific type. No value is returned when the parameter is empty.

Unit String null

The unit of the resource type. No value is returned when the parameter is empty.

StatusCategory String WithStock

The resource category based on the stock. Valid values:

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

The minimum number of available resources of a specific type. No value is returned when the parameter is empty.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=DescribeAvailableResource
&RegionId=cn-hangzhou
&DestinationResource=InstanceType
&IoOptimized=optimized
&InstanceType=ecs.g5.large
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeAvailableResourceResponse>
    <RequestId>0041D94C-FB92-4C49-B115-259DA1CE1923</RequestId>
    <AvailableZones>
        <AvailableZone>
            <Status>Available</Status>
            <RegionId>cn-hangzhou</RegionId>
            <AvailableResources>
                <AvailableResource>
                    <Type>InstanceType</Type>
                    <SupportedResources>
                        <SupportedResource>
                            <Status>Available</Status>
                            <Value>ecs.g5.large</Value>
                            <StatusCategory>WithStock</StatusCategory>
                        </SupportedResource>
                    </SupportedResources>
                </AvailableResource>
            </AvailableResources>
            <ZoneId>cn-hangzhou-i</ZoneId>
            <StatusCategory>WithStock</StatusCategory>
        </AvailableZone>
    </AvailableZones>
</DescribeAvailableResourceResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "0041D94C-FB92-4C49-B115-259DA1CE1923",
  "AvailableZones" : {
    "AvailableZone" : [ {
      "Status" : "Available",
      "RegionId" : "cn-hangzhou",
      "AvailableResources" : {
        "AvailableResource" : [ {
          "Type" : "InstanceType",
          "SupportedResources" : {
            "SupportedResource" : [ {
              "Status" : "Available",
              "Value" : "ecs.g5.large",
              "StatusCategory" : "WithStock"
            } ]
          }
        } ]
      },
      "ZoneId" : "cn-hangzhou-i",
      "StatusCategory" : "WithStock"
    } ]
  }
}

Error codes

HttpCode Error code Error message Description
400 Invalid.InstanceChargeType The specified InstanceChargeType is not valid. The error message returned because the specified value of the InstanceChargeType parameter is invalid.
400 Invalid.Param The input parameter DestinationResource that is mandatory for processing this request is not supplied. The error message returned because the specified value of the DestinationResource parameter is invalid.
400 InvalidRegionId.MalFormed The specified parameter RegionId is not valid. The error message returned because the specified value of the RegionId parameter is invalid.
403 InvalidDedicatedHostId.NotFound The specified DedicatedHostId does not exist. The error message returned because the specified value of the DedicatedHostId parameter does not exist.
403 InvalidParam.TypeAndCpuMem.Conflict The specified 'InstanceType' and 'Cores','Memory' are not blank at the same time. The error message returned because none of the InstanceType, Cores, and Memory parameters are specified.
403 InvalidParam.Cores The specified parameter 'Cores' should be empty The error message returned because the Cores parameter is specified.
403 InvalidParam.Memory The specified parameter 'Memory' should be empty The error message returned because the Memory parameter is specified.
404 Invalid.RegionId The specified RegionId does not exist. The error message returned because the specified value of the RegionId parameter is invalid.
404 Unavailable.Regions The available regions does not exists The error message returned because the specified value of the RegionId parameter is invalid.
404 Invalid.ResourceType The ResourceType provided does not exist in our records. The error message returned because the specified value of the ResourceType parameter is invalid.
404 Invalid.DestinationResource The specified DestinationResource is not valid. The error message returned because the specified value of the DestinationResource parameter is invalid.
404 Invalid.IoOptimized The specified IoOptimized is not valid. The error message returned because the specified value of the IoOptimized parameter is invalid.
404 Invalid.NetworkCategory The specified NetworkCategory is not valid. The error message returned because the specified value of the NetworkCategory parameter is invalid.
404 Invalid.SpotStrategy The specified SpotStrategy is not valid. The error message returned because the specified value of the SpotStrategy parameter is invalid.
404 Invalid.NetworkType The specified NetworkType is not valid. The error message returned because the specified value of the NetworkType parameter is invalid.
404 InvalidResourceId.NotFound The specified ResourceId is not found in our records The error message returned because the specified value of the ResourceId parameter is invalid.

For a list of error codes, visit the API Error Center.