Queries resources in a zone. You can query the resources available in a zone before you create Elastic Compute Service (ECS) instances by calling the RunInstances operation or before you change instance types by calling the ModifyInstanceSpec operation.
Operation description
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.
-
Sequence:
Zone > IoOptimized > InstanceType = Network = ddh > SystemDisk > DataDisk
-
Examples:
-
If you set
DestinationResource
toDataDisk
, take note of the following items:- If you set
ResourceType
todisk
to query the categories of data disks that are not attached to ECS instances, you do not need to specifyInstanceType
. - If you set
ResourceType
toinstance
to query the categories of data disks that are purchased together with ECS instances, you must specifyInstanceType
andSystemDiskCategory
due to instance type-specific limits on system disks and data disks.
- If you set
-
If you set
DestinationResource
toSystemDisk
andResourceType
toinstance
, you must specifyInstanceType
due to instance type-specific limits on system disks. -
If you set
DestinationResource
toInstanceType
, we recommend that you specifyIoOptimized
andInstanceType
. -
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 where ecs.g5.large resources are available in the China (Hangzhou) region, set
RegionId to cn-hangzhou, DestinationResource to Zone, IoOptimized to optimized, and InstanceType to ecs.g5.large
.
-
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 an ECS system event to notify you 5 minutes before the instance is released. Preemptible instances are billed by second. We recommend that you specify a protection period based on your business requirements. Note
This parameter takes effect only if SpotStrategy is set to SpotWithPriceLimit or SpotAsPriceGo.
| 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
This parameter must be specified when ResourceType is set to instance and DestinationResource is set to DataDisk. 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 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 | View Change Details |