All Products
Search
Document Center

Elastic Compute Service:DescribeRecommendInstanceType

Last Updated:Dec 17, 2024

Queries alternative instance types of an instance type. This operation is in internal preview. This operation lists all alternative instance types of an instance type that has been or is planed to be retired.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
CoresintegerNo

The number of vCPUs of the instance.

Note If you specify both Cores and Memory, the system returns all instance types that match the values of the parameters.
2
MemoryfloatNo

The memory size of the instance. Unit: GiB.

Note If you specify both Cores and Memory, the system returns all instance types that match the values of the parameters.
8.0
InstanceFamilyLevelstringNo

The level of the instance family. Valid values:

EnterpriseLevel
InstanceTypestringNo

The instance type. For more information, see Instance families or call the DescribeInstanceTypes operation to query the most recent instance type list.

Note If you specify InstanceType, the Cores and Memory parameters are ignored.
ecs.hfg6.large
NetworkTypestringYes

The network type of the instance. Valid values:

  • classic
  • vpc

Default value: vpc.

vpc
InstanceChargeTypestringNo

The billing method of the ECS instance. For more information, see Billing overview. Valid values:

  • PrePaid: subscription
  • PostPaid: pay-as-you-go

Default value: PostPaid.

PostPaid
SpotStrategystringNo

The bidding policy of the preemptible instance. Valid values:

  • NoSpot: The instance is a regular pay-as-you-go instance.
  • SpotWithPriceLimit: The instance is a preemptible instance for which you can specify the maximum hourly price.
  • SpotAsPriceGo: The instance is a preemptible instance for which the market price at the time of purchase is automatically used as the bid price. The market price can be up to the pay-as-you-go price.
Note If you specify SpotStrategy, you must set InstanceChargeType to PostPaid.

Default value: NoSpot.

NoSpot
IoOptimizedstringNo

Specifies whether the instance is I/O optimized. The IoOptimized parameter cannot be specified when the instance is not I/O optimized. Valid values:

  • optimized: The instance is I/O optimized.
  • none: The instance is not I/O optimized.

Default value: optimized.

If you query alternative instance types for retired instance types, this parameter is set to none by default.

optimized
PriorityStrategystringNo

The policy that is used to recommend instance types. Valid values:

  • InventoryFirst: recommends instance types in descending order of resource availability.
  • PriceFirst: recommends the most cost-effective instance types. Recommended instance types appear based on the hourly prices of vCPUs in ascending order.
  • NewProductFirst: recommends the latest instance types.

Default value: InventoryFirst.

PriceFirst
MaxPricefloatNo

The maximum hourly price for pay-as-you-go instances or preemptible instances.

Note This parameter takes effect only when SpotStrategy is set to SpotWithPriceLimit.
10.0
RegionIdstringYes

The region ID. You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
ZoneIdstringNo

The zone ID. You can call the DescribeZones operation to query the most recent zone list.

We recommend that you set the value of ZoneMatchMode to Include, which is the default value. This way, the system recommends instance types that are available in the zone specified by the ZoneId parameter based on priority. The system also recommends instance types that are available in other zones within the same region.

cn-hangzhou-f
SystemDiskCategorystringNo

The category of the system disk. Valid values:

  • cloud_efficiency: ultra disk
  • cloud_ssd: SSD
  • cloud_essd: ESSD
  • cloud: basic disk

For non-I/O optimized instances, the default value is cloud.

For I/O optimized instances, the default value is cloud_efficiency.

cloud_ssd
ZoneMatchModestringNo

Specifies whether to recommend only instance types in the zone specified by ZoneId. Valid values:

  • Strict: recommends only instance types that are available in zones specified by the ZoneId parameter.
  • Include: recommends instance types that are available in zones specified by the ZoneId parameter and other zones within the same region.

If ZoneId is specified, the default value of this parameter is Strict. This value indicates that only alternative instance types in the zone specified by ZoneId are recommended.

Strict
ScenestringNo

Specifies the scenarios in which instance types are recommended. Valid values:

  • UPGRADE: instance type upgrade or downgrade
  • CREATE: instance creation

Default value: CREATE.

CREATE
InstanceTypeFamilyarrayNo

Specifies the instance families from which the alternative instance types are selected. You can specify up to 10 instance families.

stringNo

The instance family of the instance. For more information, see Overview of instance families. You can also call the DescribeInstanceTypeFamilys operation to query the list of instance families.

ecs.hfg6

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
Dataarray<object>

The details of the recommended instance types.

RecommendInstanceTypeobject
CommodityCodestring

The commodity code of the instance type.

ecs
ZoneIdstring

The ID of the zone in which the instance type is available.

cn-hangzhou-h
Priorityinteger

The priority based on which the system sorts the instance types.

2
NetworkTypestring

The network type of the instance.

vpc
Scenestring

The scenarios in which the instance type is recommended.

CREATE
SpotStrategystring

The bidding policy for the preemptible instance.

NoSpot
RegionIdstring

The region ID of the instance type.

cn-hangzhou
InstanceChargeTypestring

The billing method of the instance.

PostPaid
Zonesarray<object>

The details of the zones where the instance types resides.

zoneobject
ZoneNostring

The ID of the zone where the instance type is available.

cn-hangzhou-h
NetworkTypesarray

The details of network types of instance types.

NetworkTypestring

The network type of the instance type.

vpc
InstanceTypeobject

The name of the instance type.

SupportIoOptimizedstring

Indicates whether the instance type supports I/O optimization.

optimized
Coresinteger

The number of vCPUs of the instance type.

1
Memoryinteger

The memory size of the instance type. Unit: MB.

8192
InstanceTypestring

The name of the instance type.

ecs.hfg6.large
InstanceTypeFamilystring

The instance family.

ecs.hfg6
Generationstring

The generation of the instance family.

ecs-4

Examples

Sample success responses

JSONformat

{
  "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 codeError codeError messageDescription
400RecommendEmpty.InstanceTypeNotAuthorizedThe 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.
400RecommendEmpty.InstanceTypeSoldOutThe 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.
400RecommendEmpty.DiskCategoryNotRecommendedThe specified disk category is not available for recommended.-
400InvalidNetworkType.ValueNotSupportedThe specified parameter NetworkType is not valid.The specified NetworkType parameter is invalid.
400InvalidSpotStrategy.ValueNotSupportedThe specified parameter SpotStrategy is not valid.-
400InvalidInstanceChargeType.NotFoundThe specified parameter InstanceChargeType is not valid.-
400InvalidPriorityStrategy.ValueNotSupportedThe specified parameter PriorityStrategy is not supported.-
400InvalidParam.TypeAndCpuMem.ConflictThe specified parameters InstanceType and Cores,Memory should not be blank at the same time.-
400InvalidIoOptimized.NotFoundThe specified parameter IoOptimized is not valid.-
400InvalidRegionId.MalFormedThe specified parameter RegionId is not valid.The specified RegionId parameter is invalid.
400InvalidDiskCategory.NotFoundThe specified parameter SystemDiskCategory is not supported.-
400InvalidInstanceTypeFamily.NotFoundThe specified InstanceTypeFamily is not valid.-
400InvalidMaxPrice.NotSupportedThe specified MaxPrice is not valid.The specified MaxPrice parameter is invalid. This parameter takes effect only for preemptible instances and must be set to a value greater than 0.
400InvalidZoneId.MalFormedThe specified ZoneId is not valid when Cores and Memory is not null.-
400InvalidInstanceType.NotSupportedThe specified InstanceType is not valid.-
400InvalidZoneId.ValueNotSupportedThe specified ZoneId is not valid.The specified ZoneId parameter is invalid.
400InvalidCoreAndMemory.ValueNotSupportedThe specified Cores/Memory does not match instance type.-
400QuotaExceed.AfterpayInstanceLiving afterpay instances quota exceeded.The maximum number of pay-as-you-go instances has been reached.
400RecommendEmpty.PerformanceNotSatisfiedThe performance of recommend instanceType is not satisfied.-
400RecommendEmpty.PriceNotSatisfiedThe 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.
400RecommendEmpty.QuotaNotSatisfiedThe 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.
400RecommendEmpty.IzNotMatchedThe iz of recommend instanceTypes are not match.-
400RecommendEmpty.InstanceTypeNotMatchedThe recommend instanceTypes are not match.-
400InvalidScene.ValueNotSupportedThe specified Scene is invalid.-
400RecommendEmpty.InstanceTypeFamilyNotMatchedThe 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.
400RecommendEmpty.GenerationNotMatchThe recommend instanceType generation are not match.-
400RecommendEmpty.NetworkTypeNotSupportedThe recommend instanceType networkType are not match.-
400InvalidInstanceFamilyLevel.NotSupportedThe specified InstanceFamilyLevel is not valid.The specified InstanceFamilyLevel parameter is invalid.
404InvalidRegionId.NotFoundThe 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 timeSummary of changesOperation
2023-12-07The Error code has changedView Change Details