(Beta)调用 DescribeRecommendInstanceType 根据一个指定的实例规格,查找一个或多个备选的实例规格。针对已经或者即将停售的实例规格,DescribeRecommendInstanceType会罗列出作为替补的所有实例规格。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| Cores |
integer |
否 |
ECS 实例 vCPU 核数。 说明
同时指定 |
2 |
| Memory |
number |
否 |
ECS 实例内存大小,单位为 GiB。 说明
同时指定 |
8.0 |
| InstanceFamilyLevel |
string |
否 |
实例规格族级别。取值范围:
|
EnterpriseLevel |
| InstanceType |
string |
否 |
指定的实例规格。更多详情,请参见实例规格族,也可以调用 DescribeInstanceTypes 接口获得最新的规格表。 说明
如果您指定了 |
ecs.hfg6.large |
| NetworkType |
string |
是 |
ECS 实例的网络类型。取值范围:
默认值:vpc |
vpc |
| InstanceChargeType |
string |
否 |
ECS 实例的计费方式。更多详情,请参见计费概述。取值范围:
默认值:PostPaid |
PostPaid |
| SpotStrategy |
string |
否 |
抢占式实例的竞价策略。取值范围:
说明
使用 默认值:NoSpot |
NoSpot |
| IoOptimized |
string |
否 |
是否为 I/O 优化实例。实例规格只支持非 I/O 优化时,不能设置 IoOptimized 参数。取值范围:
默认值:optimized 如果您设置的是已停售实例规格。默认值:none |
optimized |
| PriorityStrategy |
string |
否 |
优先推荐策略。取值范围:
默认值:InventoryFirst |
PriceFirst |
| MaxPrice |
number |
否 |
按量付费实例或者抢占式实例可接受的每小时最高价格。 说明
设置抢占式实例的最高单价时, |
10.0 |
| RegionId |
string |
是 |
地域 ID。您可以调用 DescribeRegions 查看最新的阿里云地域列表。 |
cn-hangzhou |
| ZoneId |
string |
否 |
可用区 ID。您可以调用 DescribeZones 查看最新的阿里云可用区列表。 建议同时 ZoneMatchMode 取值为 Include(默认值),优先推荐 ZoneId 指定的可用区中的实例规格,并列出同地域下其他可用区中的实例规格。 |
cn-hangzhou-f |
| SystemDiskCategory |
string |
否 |
系统盘的云盘种类。取值范围:
非 I/O 优化实例的默认值:cloud I/O 优化实例的默认值:cloud_efficiency |
cloud_ssd |
| ZoneMatchMode |
string |
否 |
是否仅推荐 ZoneId 指定的可用区中的实例规格。取值范围:
当指定 |
Strict |
| Scene |
string |
否 |
在哪种场景下推荐实例规格。取值范围:
默认值:CREATE |
CREATE |
| InstanceTypeFamily |
array |
否 |
设置备选的实例规格族集合,备选的实例规格会从该参数设置的实例规格族中选择。最多可输入 10 个实例规格族。 |
ecs.hfg6 |
|
string |
否 |
实例的规格族。规格族取值请参见实例规格族。您也可以调用 DescribeInstanceTypeFamilys 查询规格族列表。 |
ecs.hfg6 |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| RequestId |
string |
请求 ID。 |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
| Data |
object |
||
| RecommendInstanceType |
array<object> |
推荐的实例规格集合。 |
|
|
array<object> |
|||
| CommodityCode |
string |
实例规格的商品编码。 |
ecs |
| ZoneId |
string |
实例规格所在的可用区 ID。 |
cn-hangzhou-h |
| Priority |
integer |
排序优先级。 |
2 |
| NetworkType |
string |
ECS 实例的网络类型。 |
vpc |
| Scene |
string |
在哪种场景下推荐实例规格。 |
CREATE |
| SpotStrategy |
string |
抢占式实例的抢占策略。 |
NoSpot |
| RegionId |
string |
实例规格所在的地域 ID。 |
cn-hangzhou |
| InstanceChargeType |
string |
实例的计费方式。 |
PostPaid |
| Zones |
object |
||
| zone |
array<object> |
实例规格所在的可用区集合。 |
|
|
array<object> |
|||
| ZoneNo |
string |
实例规格所在的可用区 ID。 |
cn-hangzhou-h |
| NetworkTypes |
object |
||
| NetworkType |
array |
实例规格的网络类型集合。 |
|
|
string |
实例规格的网络类型。 |
vpc |
|
| InstanceType |
object |
实例规格名称。 |
|
| SupportIoOptimized |
string |
实例规格是否支持 I/O 优化。 |
optimized |
| Cores |
integer |
实例规格的 vCPU 核数。 |
1 |
| Memory |
integer |
实例规格的内存大小,单位为 MB。 |
8192 |
| InstanceType |
string |
实例规格名称。 |
ecs.hfg6.large |
| InstanceTypeFamily |
string |
实例规格族。 |
ecs.hfg6 |
| Generation |
string |
实例规格族系列。 |
ecs-4 |
示例
正常返回示例
JSON格式
{
"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"
}
}
]
}
}
异常返回示例
JSON格式
{
"Data":{
"RecommendInstanceType":[
{
"CommodityCode":"ecs",
"RegionNo":"us-west-ot7-a01",
"Scene":"CREATE",
"Zones":{
"zone":[
]
},
"InstanceType":{
"Memory":8192,
"Cores":1,
"InstanceTypeFamily":"ecs.s1",
"SupportIoOptimized":"none",
"Generation":"ecs-1",
"InstanceType":"ecs.s1.large"
}
},
{
"CommodityCode":"ecs",
"RegionNo":"us-west-ot7-a01",
"Scene":"CREATE",
"Zones":{
"zone":[
{
"ZoneNo":"us-west-1a",
"NetworkTypes":{
"NetworkType":[
"vpc"
]
}
}
]
},
"InstanceType":{
"Memory":8192,
"Cores":1,
"InstanceTypeFamily":"ecs.e4",
"SupportIoOptimized":"optimized",
"Generation":"ecs-3",
"InstanceType":"ecs.e4.small"
}
},
{
"CommodityCode":"ecs",
"RegionNo":"us-west-ot7-a01",
"Scene":"CREATE",
"Zones":{
"zone":[
{
"ZoneNo":"us-west-1a",
"NetworkTypes":{
"NetworkType":[
"vpc"
]
}
}
]
},
"InstanceType":{
"Memory":8192,
"Cores":2,
"InstanceTypeFamily":"ecs.sn2",
"SupportIoOptimized":"optimized",
"Generation":"ecs-2",
"InstanceType":"ecs.sn2.medium"
}
},
{
"CommodityCode":"ecs",
"RegionNo":"us-west-ot7-a01",
"Scene":"CREATE",
"Zones":{
"zone":[
]
},
"InstanceType":{
"Memory":8192,
"Cores":1,
"InstanceTypeFamily":"ecs.e3",
"SupportIoOptimized":"optimized",
"Generation":"ecs-2",
"InstanceType":"ecs.e3.small"
}
}
]
},
"RequestId":"775643e7-8297-40ee-b9e6-f0a252aa152d"
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | RecommendEmpty.InstanceTypeNotAuthorized | The recommend instanceTypes are not authorized. | 推荐集合为空。地域/可用区下无合适的备选规格。 |
| 400 | RecommendEmpty.InstanceTypeSoldOut | The recommend instanceTypes are out of usage. | 推荐规格集合为空,可用区/地域下规格售罄,无合适备选规格。 |
| 400 | RecommendEmpty.DiskCategoryNotRecommended | The specified disk category is not available for recommended. | 指定的磁盘类型无库存。 |
| 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. | 不能同时将参数 `InstanceType` 和 `Cores`、`Memory` 设置为空 |
| 400 | InvalidIoOptimized.NotFound | The specified parameter IoOptimized is not valid. | 指定的IO优化参数IoOptimized无效。 |
| 400 | InvalidRegionId.MalFormed | The specified parameter RegionId is not valid. | 指定的 RegionId 不合法。 |
| 400 | InvalidDiskCategory.NotFound | The specified parameter SystemDiskCategory is not supported. | 指定的磁盘类型DiskCategory不支持。 |
| 400 | InvalidInstanceTypeFamily.NotFound | The specified InstanceTypeFamily is not valid. | |
| 400 | InvalidMaxPrice.NotSupported | The specified MaxPrice is not valid. | 指定的最大价格字段信息无效。该字段只有在竞价实例场景下有效,必须大于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. | 指定 ZoneId 无效。 |
| 400 | InvalidCoreAndMemory.ValueNotSupported | The specified Cores/Memory does not match instance type. | 指定的CPU核数、内存配置与指定的规格(族)不符。 |
| 400 | QuotaExceed.AfterpayInstance | Living afterpay instances quota exceeded. | 活跃的按量付费实例数已达上限。 |
| 400 | RecommendEmpty.PerformanceNotSatisfied | The performance of recommend instanceType is not satisfied. | |
| 400 | RecommendEmpty.PriceNotSatisfied | The current price of recommend instanceTypes above user max price. | 推荐集合为空,地域/可用区下无满足价格要求的可选规格。 |
| 400 | RecommendEmpty.QuotaNotSatisfied | The quota of recommend instanceTypes are out of usage. | 推荐集合为空,地域/可用区下因quota受限,无可选规格。 |
| 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. | 推荐集合为空,地域/可用区下无满足规格族集合要求的可选规格。 |
| 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. | 输入InstanceFamilyLevel信息无效。 |
| 404 | InvalidRegionId.NotFound | The RegionId provided does not exist in our records. | 地域信息错误 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。