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 > DataDiskExamples:
You set
DestinationResourcetoDataDisk.If you set
ResourceTypetodiskto query data disk categories that are independent of ECS instance types, you do not need to specifyInstanceType.If you set
ResourceTypetoinstanceto query the categories of data disks that are purchased together with ECS instances, you must specifyInstanceTypeandSystemDiskCategorydue to instance type-specific limits on system disks and data disks.
If you set
DestinationResourcetoSystemDiskandResourceTypetoinstance, you must specifyInstanceTypedue to instance type-specific limits on system disks.If you set
DestinationResourcetoInstanceType, we recommend that you specifyIoOptimizedandInstanceType.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
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:
Default value: PostPaid. |
SpotStrategy | String | No | NoSpot | The bidding policy for the pay-as-you-go instance. Valid values:
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:
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:
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 |
IoOptimized | String | No | optimized | Specifies whether the instance is I/O optimized. Valid values:
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:
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:
|
NetworkCategory | String | No | vpc | The network type. Valid values:
|
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:
|
Scope | String | No | Region | The scope of the reserved instance. Valid values:
|
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:
|
StatusCategory | String | WithStock | The resource category based on the stock level. Valid values:
|
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:
|
SupportedResources | Array of SupportedResource | The queried resources. | |
SupportedResource | |||
Status | String | Available | The status of the resource. Valid values:
|
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:
|
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.