(Beta) Queries one or more alternative instance types based on a specified instance type. For instance types that have been or will be retired, DescribeRecommendInstanceType lists all instance types that can serve as replacements.
Try it now
Test
RAM authorization
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Cores |
integer |
No |
The number of vCPUs of the ECS instance. Note
If you specify both the Cores and Memory parameters, the system matches all instance types that meet the specified vCPU and memory requirements. |
2 |
| Memory |
number |
No |
The memory size of the ECS instance. Unit: GiB. Note
If you specify both the Cores and Memory parameters, the system matches all instance types that meet the specified vCPU and memory requirements. |
8.0 |
| InstanceFamilyLevel |
string |
No |
The level of the instance family. Valid values:
|
EnterpriseLevel |
| InstanceType |
string |
No |
The specified instance type. For details, see Instance families. You can also call the DescribeInstanceTypes operation to query the most recent instance type list. Note
If you specify InstanceType, you cannot specify Cores or Memory. |
ecs.hfg6.large |
| NetworkType |
string |
Yes |
The network type of the ECS instance. Valid values:
Default value: vpc. |
vpc |
| InstanceChargeType |
string |
No |
The billing method of the ECS instance. For details, see Billing overview. Valid values:
Default value: PostPaid. |
PostPaid |
| SpotStrategy |
string |
No |
The bidding policy for the spot instance. Valid values:
Note
When you use SpotStrategy, set InstanceChargerType to PostPaid. Default value: NoSpot. |
NoSpot |
| IoOptimized |
string |
No |
Specifies whether the instance is I/O optimized. If the instance type supports only non-I/O optimized instances, you cannot set the IoOptimized parameter. Valid values:
Default value: optimized. If you specify a retired instance type, the default value is none. |
optimized |
| PriorityStrategy |
string |
No |
The priority-based recommendation strategy. Valid values:
Default value: InventoryFirst. |
PriceFirst |
| MaxPrice |
number |
No |
The maximum acceptable hourly price for pay-as-you-go or spot instances. Note
To set the maximum hourly price for a spot instance, set SpotStrategy to SpotWithPriceLimit. |
10.0 |
| RegionId |
string |
Yes |
The region ID. You can call DescribeRegions to query the most recent region list. |
cn-hangzhou |
| ZoneId |
string |
No |
The zone ID. You can call DescribeZones to query the most recent zone list. Set ZoneMatchMode to Include (default value) to preferentially recommend instance types in the zone specified by ZoneId and also list instance types in other zones within the same region. |
cn-hangzhou-f |
| SystemDiskCategory |
string |
No |
The category of the system disk. Valid values:
Default value for non-I/O optimized instances: cloud. Default value for I/O optimized instances: cloud_efficiency. |
cloud_ssd |
| ZoneMatchMode |
string |
No |
Specifies whether to recommend only instance types in the zone specified by ZoneId. Valid values:
When ZoneId is specified, the default value of this parameter is Strict, which indicates that only instance types in the zone specified by ZoneId are recommended. |
Strict |
| Scene |
string |
No |
The scenario in which instance types are recommended. Valid values:
Default value: CREATE. |
CREATE |
| InstanceTypeFamily |
array |
No |
Settings for the collection of alternative instance families from which alternative instance types are selected. You can specify up to 10 instance families. |
ecs.hfg6 |
|
string |
No |
The instance family. For valid values of instance types, see Instance families. You can also call DescribeInstanceTypeFamilys to query the instance family list. |
ecs.hfg6 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
| Data |
object |
||
| RecommendInstanceType |
array<object> |
The recommended instance types. |
|
|
array<object> |
|||
| CommodityCode |
string |
The commodity code of the instance type. |
ecs |
| ZoneId |
string |
The zone ID of the instance type. |
cn-hangzhou-h |
| Priority |
integer |
The priority for sorting. |
2 |
| NetworkType |
string |
The network type of the ECS instance. |
vpc |
| Scene |
string |
The scenario in which the instance type is recommended. |
CREATE |
| SpotStrategy |
string |
The bidding policy for the spot instance. |
NoSpot |
| RegionId |
string |
The region ID of the instance type. |
cn-hangzhou |
| InstanceChargeType |
string |
The billing method of the instance. |
PostPaid |
| Zones |
object |
||
| zone |
array<object> |
The zones of the instance type. |
|
|
array<object> |
|||
| ZoneNo |
string |
The zone ID of the instance type. |
cn-hangzhou-h |
| NetworkTypes |
object |
||
| NetworkType |
array |
The network types of the instance type. |
|
|
string |
The network type of the instance type. |
vpc |
|
| InstanceType |
object |
The name of the instance type. |
|
| SupportIoOptimized |
string |
Indicates whether the instance type supports I/O optimization. |
optimized |
| Cores |
integer |
The number of vCPUs of the instance type. |
1 |
| Memory |
integer |
The memory size of the instance type. Unit: MB. |
8192 |
| InstanceType |
string |
The name of the instance type. |
ecs.hfg6.large |
| InstanceTypeFamily |
string |
The instance family. |
ecs.hfg6 |
| Generation |
string |
The instance family generation. |
ecs-4 |
Examples
Success response
JSON format
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
"Data": {
"RecommendInstanceType": [
{
"CommodityCode": "ecs",
"ZoneId": "cn-hangzhou-h",
"Priority": 2,
"NetworkType": "vpc",
"Scene": "CREATE",
"SpotStrategy": "NoSpot",
"RegionId": "cn-hangzhou",
"InstanceChargeType": "PostPaid",
"Zones": {
"zone": [
{
"ZoneNo": "cn-hangzhou-h",
"NetworkTypes": {
"NetworkType": [
"vpc"
]
}
}
]
},
"InstanceType": {
"SupportIoOptimized": "optimized",
"Cores": 1,
"Memory": 8192,
"InstanceType": "ecs.hfg6.large",
"InstanceTypeFamily": "ecs.hfg6",
"Generation": "ecs-4"
}
}
]
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | RecommendEmpty.InstanceTypeNotAuthorized | The recommend instanceTypes are not authorized. | No instance types can be recommended because no appropriate alternative instance types are available in the specified region or zone. |
| 400 | RecommendEmpty.InstanceTypeSoldOut | The recommend instanceTypes are out of usage. | No instance types can be recommended because the specified instance type is sold out and no appropriate alternative instance types are available within the specified region or zone. |
| 400 | RecommendEmpty.DiskCategoryNotRecommended | The specified disk category is not available for recommended. | The specified disk category is out of stock. |
| 400 | InvalidNetworkType.ValueNotSupported | The specified parameter NetworkType is not valid. | |
| 400 | InvalidSpotStrategy.ValueNotSupported | The specified parameter SpotStrategy is not valid. | |
| 400 | InvalidInstanceChargeType.NotFound | The specified parameter InstanceChargeType is not valid. | |
| 400 | InvalidPriorityStrategy.ValueNotSupported | The specified parameter PriorityStrategy is not supported. | |
| 400 | InvalidParam.TypeAndCpuMem.Conflict | The specified parameters InstanceType and Cores,Memory should not be blank at the same time. | |
| 400 | InvalidIoOptimized.NotFound | The specified parameter IoOptimized is not valid. | The specified IO optimization parameter IoOptimized is invalid. |
| 400 | InvalidRegionId.MalFormed | The specified parameter RegionId is not valid. | The specified RegionId parameter is invalid. |
| 400 | InvalidDiskCategory.NotFound | The specified parameter SystemDiskCategory is not supported. | The specified disk type DiskCategory not supported. |
| 400 | InvalidInstanceTypeFamily.NotFound | The specified InstanceTypeFamily is not valid. | |
| 400 | InvalidMaxPrice.NotSupported | The specified MaxPrice is not valid. | The specified MaxPrice parameter is invalid. This parameter takes effect only for Spot instances and must be set to a value greater than 0. |
| 400 | InvalidZoneId.MalFormed | The specified ZoneId is not valid when Cores and Memory is not null. | |
| 400 | InvalidInstanceType.NotSupported | The specified InstanceType is not valid. | |
| 400 | InvalidZoneId.ValueNotSupported | The specified ZoneId is not valid. | The specified ZoneId parameter is invalid. |
| 400 | InvalidCoreAndMemory.ValueNotSupported | The specified Cores/Memory does not match instance type. | The specified number of CPU cores and memory configuration do not match the specified specification (family). |
| 400 | QuotaExceed.AfterpayInstance | Living afterpay instances quota exceeded. | The maximum number of pay-as-you-go instances has been reached. |
| 400 | RecommendEmpty.PerformanceNotSatisfied | The performance of recommend instanceType is not satisfied. | |
| 400 | RecommendEmpty.PriceNotSatisfied | The current price of recommend instanceTypes above user max price. | No instance types can be recommended because no instance types that meet the price requirements are available within the specified region or zone. |
| 400 | RecommendEmpty.QuotaNotSatisfied | The quota of recommend instanceTypes are out of usage. | No instance types can be recommended because none are available within the specified region or zone due to limited quotas. |
| 400 | RecommendEmpty.IzNotMatched | The iz of recommend instanceTypes are not match. | |
| 400 | RecommendEmpty.InstanceTypeNotMatched | The recommend instanceTypes are not match. | |
| 400 | InvalidScene.ValueNotSupported | The specified Scene is invalid. | |
| 400 | RecommendEmpty.InstanceTypeFamilyNotMatched | The recommend instanceTypeFamily are not match. | No instance types can be recommended because no instance types that meet the requirements for the array of instance types are available within the specified region or zone. |
| 400 | RecommendEmpty.GenerationNotMatch | The recommend instanceType generation are not match. | |
| 400 | RecommendEmpty.NetworkTypeNotSupported | The recommend instanceType networkType are not match. | |
| 400 | InvalidInstanceFamilyLevel.NotSupported | The specified InstanceFamilyLevel is not valid. | The specified InstanceFamilyLevel parameter is invalid. |
| 404 | InvalidRegionId.NotFound | The RegionId provided does not exist in our records. | Region information error |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.