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
toDataDisk
, you must specify theInstanceType
parameter or set theResourceType
parameter todisk
. - If you set
DestinationResource
toSystemDisk
, you must specify theInstanceType
parameter. - If you set
DestinationResource
toInstanceType
, you must specify theIoOptimized
andInstanceType
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.``
- If you set
Debugging
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | 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 |
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. The SpotStrategy parameter takes effect only when the InstanceChargeType parameter is set to PostPaid. | NoSpot |
SpotDuration | integer | No | 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.
| 1 |
DestinationResource | string | Yes | The resource type to query. Valid values:
For more information about how to configure the DestinationResource parameter, see the Description section of this topic. | InstanceType |
ZoneId | string | No | 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 | 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 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 |
SystemDiskCategory | string | No | The category of the system disk. Valid values:
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 |
DataDiskCategory | string | No | The type of the data disk. Valid values:
| cloud_ssd |
NetworkCategory | string | No | The network type of the cluster. Valid values:
| vpc |
Cores | integer | No | 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 |
Memory | float | No | 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 |
ResourceType | string | No | The type of the resource. Valid values:
| instance |
Scope | string | No | The scope of the reserved instance. Valid values:
| Region |
Response parameters
Examples
Sample success responses
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": 2,
"Unit": "null",
"StatusCategory": "WithStock",
"Min": 1
}
]
}
}
]
}
}
]
}
}
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 | - |
403 | InvalidParam.Memory | The specified parameter 'Memory' should be empty | - |
403 | InvalidParameter.Scope | The specified parameter Scope is invalid. | - |
403 | OperationDenied.RegionIdNotSupported | region not support spot duration instance. | - |
403 | OperationDenied.FlavorNotSupported | flavor not support spot duration instance. | - |
403 | OperationDenied.TimestampNotSupported | timestamp not support spot duration instance. | - |
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 regions does not exists | The specified RegionId parameter is invalid. |
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 ResourceId parameter is invalid. Check whether the resource exists. |
404 | InvalidRegionId.NotFound | The 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.
Change history
Change time | Summary of changes | Operation | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
2024-03-25 | The Error code has changed | see changesets | ||||||||
|