All Products
Search
Document Center

Elastic Compute Service:DescribeAvailableResource

Last Updated:Mar 19, 2024

Queries the availability of resources in a zone. You can call this operation before you create or modify instances to ensure that sufficient resources are available.

Operation description

The value of the DestinationResource parameter determines whether you need to specify additional parameters. The following sequence provides the order by which resources are filtered. You cannot query a higher order resource by specifying a lower order resource.

  • 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 available ecs.g5.large resources in all zones of the China (Hangzhou) region, you must 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, 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.

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 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.
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: 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.
cloud_ssd
DataDiskCategorystringNo

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_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*****
AvailableZonesobject []

Details about the zones in which resources are available.

ZoneIdstring

The ID of the zone in which the instance resides.

cn-hangzhou-e
Statusstring

The state of resources in the zone. Valid values:

  • Available
  • SoldOut
Available
StatusCategorystring

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.
WithStock
RegionIdstring

The ID of the region where the instance resides.

cn-hangzhou
AvailableResourcesobject []

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

Typestring

The type of a 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.
InstanceType
SupportedResourcesobject []

Details about the resources.

Statusstring

The state of the resource. Valid values:

  • Available
  • SoldOut
Available
Valuestring

The resource type.

ecs.d1ne.xlarge
Maxinteger

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

2
Unitstring

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

null
StatusCategorystring

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.
WithStock
Mininteger

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

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.