All Products
Search
Document Center

:DescribeAvailableResource

Last Updated:Jan 12, 2024

Queries resources in a zone. 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.

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.

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

  • Examples:

    • You set DestinationResource to DataDisk.

      • If you set ResourceType to disk to query data disk categories that are independent of ECS instance types, 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 in the China (Hangzhou) region where ecs.g5.large resources are available, 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 ID of the region. 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 bidding policy for the pay-as-you-go instance. Valid values:

  • NoSpot: The instance is a pay-as-you-go instance.

  • SpotWithPriceLimit: The instance is created as a preemptible instance for which you can specify the maximum hourly price.

  • SpotAsPriceGo: The instance is created as a preemptible instance whose price is based on the market price at the time of purchase. The market price can be equal to the price of a pay-as-you-go instance.

Default value: NoSpot.

This parameter takes effect only if you set InstanceChargeType to PostPaid.

SpotDuration

Integer

No

1

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 bidding 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 biding price with the market price and checks the resource inventory to determine whether to retain or release the instance.

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

Note

If you set SpotStrategy to SpotWithPriceLimit or SpotAsPriceGo, this parameter takes effect.

DestinationResource

String

Yes

InstanceType

The type of the resource. 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 specify DestinationResource, see the "Usage notes" section of this topic.

ZoneId

String

No

cn-hangzhou-e

The ID of the zone.

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

IoOptimized

String

No

optimized

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

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

  • optimized: The instance is 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 Overview of instance families. You can also call the DescribeInstanceTypes operation to query the most recent instance type list.

For more information about how to specify InstanceType, see the Usage notes section of this topic.

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: ESSD.

  • cloud_auto: ESSD AutoPL disk.

Default value: cloud_efficiency.

Note

If you set ResourceType to instance and DestinationResource to DataDisk, you must specify SystemDiskCategory. If you do not specify this parameter, the default value is used.

DataDiskCategory

String

No

cloud_ssd

The type 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.

NetworkCategory

String

No

vpc

The network type. Valid values:

  • vpc: virtual private cloud (VPC).

  • classic: classic network.

Cores

Integer

No

2

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

This parameter takes effect only if you set DestinationResource to InstanceType.

Memory

Float

No

8.0

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

This parameter takes effect only if you set DestinationResource to InstanceType.

ResourceType

String

No

instance

The resource type. Valid values:

  • instance: ECS instance.

  • disk: cloud disk.

  • reservedinstance: reserved instance.

  • ddh: dedicated host.

Scope

String

No

Region

The scope of the reserved instance. Valid values:

  • Region: regional.

  • Zone: zonal

Response parameters

Parameter

Type

Example

Description

RequestId

String

0041D94C-FB92-4C49-B115-259DA1C*****

The ID of the request.

AvailableZones

Array of AvailableZone

The queried zones.

AvailableZone

ZoneId

String

cn-hangzhou-e

The ID of the zone.

Status

String

Available

The status of the resources in the zone. Valid values:

  • Available

  • SoldOut

StatusCategory

String

WithStock

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

  • WithStock: Resources are sufficient.

  • ClosedWithStock: Resources are insufficient. We recommend that you use other resources that have sufficient stock.

  • WithoutStock: Resources are sold out and will be replenished. We recommend that you use other resources that have sufficient stock.

  • ClosedWithoutStock: Resources are sold out but will not be replenished. We recommend that you use other resources that have sufficient stock.

RegionId

String

cn-hangzhou

The ID of the region.

AvailableResources

Array of AvailableResource

The resources that are available in the zone.

AvailableResource

Type

String

InstanceType

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.

SupportedResources

Array of SupportedResource

The queried resources.

SupportedResource

Status

String

Available

The status of the resource. Valid values:

  • Available

  • SoldOut

Value

String

ecs.d1ne.xlarge

The resource type.

Max

Integer

2048

The maximum disk capacity.

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

Unit

String

GiB

The unit of the disk capacity.

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

StatusCategory

String

WithStock

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

  • WithStock: Resources are sufficient.

  • ClosedWithStock: Resources are insufficient. We recommend that you use other resources that have sufficient stock.

  • WithoutStock: Resources are sold out and will be replenished. We recommend that you use other resources that have sufficient stock.

  • ClosedWithoutStock: Resources are sold out and will not be replenished. We recommend that you use other resources that have sufficient stock.

Min

Integer

20

The minimum disk capacity.

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

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-259DA1C*****</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-259DA1C*****",
  "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.

Invalid InstanceChargeType value.

400

Invalid.Param

The input parameter DestinationResource that is mandatory for processing this request is not supplied.

Invalid DestinationResource value.

400

InvalidRegionId.MalFormed

The specified parameter RegionId is not valid.

Invalid RegionId value.

403

InvalidDedicatedHostId.NotFound

The specified DedicatedHostId does not exist.

Invalid DedicatedHostId value.

404

Invalid.RegionId

The specified RegionId does not exist.

Invalid RegionId value.

404

Unavailable.Regions

The available regions does not exists

Invalid RegionId value.

404

Invalid.ResourceType

The ResourceType provided does not exist in our records.

Invalid ResourceType value.

404

Invalid.DestinationResource

The specified DestinationResource is not valid.

Invalid DestinationResource value.

404

Invalid.IoOptimized

The specified IoOptimized is not valid.

Invalid IoOptimized value.

404

Invalid.NetworkCategory

The specified NetworkCategory is not valid.

Invalid NetworkCategory value.

404

Invalid.SpotStrategy

The specified SpotStrategy is not valid.

Invalid SpotStrategy value.

404

Invalid.NetworkType

The specified NetworkType is not valid.

Invalid NetworkType value.

404

InvalidResourceId.NotFound

The specified ResourceId is not found in our records

Invalid ResourceId value. Check whether the resource exists.

For a list of error codes, see Service error codes.