Queries the inventory status of resources in a specified zone. This operation is primarily used to check whether target resources, such as instance types and system disk types, are available in a specific zone before you create instances (RunInstances) or modify instance specifications (ModifyInstanceSpec).
Operation description
The DestinationResource parameter has different logic and requirements depending on its value. In the following ordered list, a lower-ranked value requires more parameters to be set. You cannot use a lower-ranked value to filter resources of a higher-ranked category.
-
Value order:
Zone > IoOptimized > InstanceType = Network = ddh > SystemDisk > DataDisk -
Examples:
-
If DestinationResource is set to
DataDisk:-
If
ResourceTypeis set todisk, the operation queries data disk types that are not associated with a specific ECS instance type. In this case, the InstanceType parameter is optional. -
If
ResourceTypeis set toinstance, the operation queries data disk types that can be attached to an ECS instance. Because instance types impose restrictions on data disks, you must specify bothInstanceTypeandDataDiskCategory.
-
-
If DestinationResource is set to
SystemDiskandResourceTypeis set toinstance, you must specify the InstanceType parameter because ECS instance types impose restrictions on system disks. -
If DestinationResource is set to
InstanceType, specify the IoOptimized and InstanceType parameters. -
Query the inventory of ecs.g5.large across all zones in a specified region:
RegionId=ap-southeast-1 &DestinationResource=InstanceType &IoOptimized=optimized &InstanceType=ecs.g5.large. -
Query the zones in a specified region where ecs.g5.large is available:
RegionId=ap-southeast-1 &DestinationResource=Zone &IoOptimized=optimized &InstanceType=ecs.g5.large.
-
Try it now
Test
RAM authorization
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The ID of the destination region. You can call DescribeRegions to query the most recent region list. |
cn-hangzhou |
| InstanceChargeType |
string |
No |
The billing method of the resource. For more information, see Billing overview. Valid values:
Default value: PostPaid. |
PrePaid |
| SpotStrategy |
string |
No |
The bidding policy for pay-as-you-go instances. Valid values:
Default value: NoSpot. This parameter takes effect only when InstanceChargeType is set to |
NoSpot |
| SpotDuration |
integer |
No |
The protection period of the spot instance. Unit: hours. Default value: 1. Valid values:
Alibaba Cloud sends an ECS system event notification 5 minutes before the instance is released. Spot instances are billed by second. Select an appropriate protection period based on the expected task execution duration. Note
This parameter takes effect only when |
1 |
| DestinationResource |
string |
Yes |
The type of resource to query. Valid values:
Note
When DestinationResource is set to For more information about how to set the DestinationResource parameter, see the operation description section of this topic. |
InstanceType |
| ZoneId |
string |
No |
The zone ID. Default value: null. The operation returns resources that match the query conditions across all zones in the specified region (RegionId). |
cn-hangzhou-e |
| IoOptimized |
string |
No |
Specifies whether the instance is an I/O optimized instance. Valid values:
Default value: optimized. |
optimized |
| DedicatedHostId |
string |
No |
The ID of the dedicated host. |
dh-bp165p6xk2tlw61e**** |
| InstanceType |
string |
No |
The instance type. For more information, see Instance family. You can also invoke DescribeInstanceTypes to query the most recent instance type list. For more information about how to set the InstanceType parameter, see the operation description section at the beginning of this topic. |
ecs.g5.large |
| SystemDiskCategory |
string |
No |
The category of the system disk. Valid values:
Default value description:
Note
When ResourceType is set to instance and DestinationResource is set to DataDisk, the SystemDiskCategory parameter is required. If you do not specify this parameter, the default value takes effect. |
cloud_ssd |
| DataDiskCategory |
string |
No |
The category of the data disk. Valid values:
|
cloud_ssd |
| NetworkCategory |
string |
No |
The network type. Valid values:
|
vpc |
| Cores |
integer |
No |
The number of vCPU cores of the instance type. For valid values, see Instance family. This parameter takes effect only when DestinationResource is set to InstanceType. |
2 |
| Memory |
number |
No |
The memory size of the instance type. Unit: GiB. For valid values, see Instance family. This parameter takes effect only when DestinationResource is set to InstanceType. |
8.0 |
| ResourceType |
string |
No |
The type of the resource. Valid values:
|
instance |
| Scope |
string |
No |
The scope of the reserved instance. Valid values:
|
Region |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
0041D94C-FB92-4C49-B115-259DA1C***** |
| AvailableZones |
object |
||
| AvailableZone |
array<object> |
The collection of zone inventory information. |
|
|
array<object> |
The zone inventory information. |
||
| ZoneId |
string |
The ID of the availability zone. |
cn-hangzhou-e |
| Status |
string |
The status of the availability zone. Possible values:
|
Available |
| StatusCategory |
string |
The detailed inventory-based status of the availability zone. Possible values:
|
WithStock |
| RegionId |
string |
The ID of the region. |
cn-hangzhou |
| AvailableResources |
object |
The available resources. |
|
| AvailableResource |
array<object> |
An array of the specific resources that you can create. |
|
|
array<object> |
Details of a specific resource that you can create. |
||
| Type |
string |
The resource type. Possible values:
|
InstanceType |
| SupportedResources |
object |
The supported resources. |
|
| SupportedResource |
array<object> |
An array of the supported resources that you can create. |
|
|
object |
Details of a supported resource that you can create. |
||
| Status |
string |
The status of the resource. Possible values:
|
Available |
| Value |
string |
The value of the resource. |
ecs.d1ne.xlarge |
| Max |
integer |
The maximum capacity of the cloud disk. Note
This parameter is returned only when |
2048 |
| Unit |
string |
The capacity unit of the cloud disk. Note
This parameter is returned only when |
GiB |
| StatusCategory |
string |
The detailed inventory-based status of the resource. Possible values:
|
WithStock |
| Min |
integer |
The minimum capacity of the cloud disk. Note
This parameter is returned only when |
20 |
Examples
Success response
JSON format
{
"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": 2048,
"Unit": "GiB",
"StatusCategory": "WithStock",
"Min": 20
}
]
}
}
]
}
}
]
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | Invalid.InstanceChargeType | The specified InstanceChargeType is not valid. | The specified InstanceChargeType parameter is invalid. |
| 400 | Invalid.Param | The input parameter DestinationResource that is mandatory for processing this request is not supplied. | The specified DestinationResource parameter is invalid. |
| 400 | InvalidRegionId.MalFormed | The specified parameter RegionId is not valid. | The specified RegionId parameter is invalid. |
| 403 | InvalidDedicatedHostId.NotFound | The specified DedicatedHostId does not exist. | |
| 403 | InvalidParam.TypeAndCpuMem.Conflict | The specified 'InstanceType' and 'Cores','Memory' are not blank at the same time. | |
| 403 | InvalidParam.Cores | The specified parameter 'Cores' should be empty. | The specified parameter 'Cores' should be empty. |
| 403 | InvalidParam.Memory | The specified parameter 'Memory' should be empty. | The specified parameter 'Memory' should be empty. |
| 403 | InvalidParameter.Scope | The specified parameter Scope is invalid. | The specified parameter Scope is invalid. |
| 403 | OperationDenied.RegionIdNotSupported | The region does not support preemptible instances. | |
| 403 | OperationDenied.FlavorNotSupported | The flavor does not support preemptible instances. | |
| 403 | OperationDenied.TimestampNotSupported | Preemptible instances are not for sale for current time. | |
| 403 | InvalidParameter.ResourceOwnerId | The specified parameter ResourceOwnerId is not available anymore. | |
| 404 | Invalid.RegionId | The specified RegionId does not exist. | The specified RegionId parameter is invalid. |
| 404 | Unavailable.Regions | The available region does not exist. | |
| 404 | Invalid.ResourceType | The ResourceType provided does not exist in our records. | The specified resource type is invalid. |
| 404 | Invalid.DestinationResource | The specified DestinationResource is not valid. | The specified DestinationResource parameter is invalid. |
| 404 | Invalid.IoOptimized | The specified IoOptimized is not valid. | The specified IoOptimized parameter is invalid. |
| 404 | Invalid.NetworkCategory | The specified NetworkCategory is not valid. | The specified NetworkCategory parameter is invalid. |
| 404 | Invalid.SpotStrategy | The specified SpotStrategy is not valid. | The specified SpotStrategy parameter is invalid. |
| 404 | Invalid.NetworkType | The specified NetworkType is not valid. | The specified NetworkType parameter is invalid. |
| 404 | InvalidResourceId.NotFound | The specified ResourceId is not found in our records. | The specified resource does not exist. Check whether the resource ID is correct. |
| 404 | InvalidRegionId.NotFound | The RegionId provided does not exist in our records. | Region information error |
| 404 | InvalidDedicatedHostId.NotFound | The specified Dedicated Host does not exist. | The specified dedicated host does not exist. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.