Queries the Elastic Compute Service (ECS) instance types and instance families that are available in a specified region and zone.

Description

When you call the CreateContainerGroup operation to create an elastic container instance, you can use the InstanceType parameter to specify one or more ECS instance types that fit your specific needs. To ensure that the elastic container instance can be created, you can call the DescribeAvailableResource operation to query which ECS instance types and instance families are available in the specified region and zone before you create the elastic container instance.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeAvailableResource

The operation that you want to perform. Set the value to DescribeAvailableResource.

RegionId String Yes cn-hangzhou

The ID of the region.

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

ZoneId String No cn-hangzhou-e

The ID of the zone.

This parameter is empty by default, which indicates that ECS instance families available in all zones in the specified region are queried.

DestinationResource Object Yes

The information about the resource that you want to query.

Category String Yes InstanceTypeFamily

The type of the resource. Valid values:

  • InstanceTypeFamily: queries instance families. If you use this parameter value, you must also specify the Value parameter.
  • InstanceType: queries instance types. If you use this parameter value, you must also specify the Value, Cores, and Memory parameters.
Value String No ecs.c6

Instance families or instance types.

  • If you set Category to InstanceTypeFamily, you must set this parameter to instance families such as ecs. c5.
  • If you set Category to InstanceType, you must set this parameter to instance types such as ecs.c5.large.
Cores Float No 2

The number of vCPUs. This parameter is available only when the Category parameter is set to InstanceType.

Memory Float No 4

The memory size. Unit: GiB. This parameter is available only when the Category parameter is set to InstanceType.

SpotResource Object No

The information of the preemptible instances that you want to query.

SpotStrategy String No SpotAsPriceGo

The bidding policy for the elastic container instance. Valid values:

  • NoSpot: The instance is a regular pay-as-you-go instance.
  • SpotWithPriceLimit: The instance is a preemptible instance with a user-defined 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.

Default value: NoSpot.

Note If you set this parameter to SpotWithPriceLimit or SpotAsPriceGo to query preemptible instances, you must set Category to InstanceType. In addition, you must use the Value parameter to specify instance types, or use the Cores and Memory parameters to specify the number of vCPUs and memory size.
SpotPriceLimit double No 0.2

The maximum hourly price of the preemptible elastic container instance. The value can be accurate to three decimal places. If you set SpotStrategy to SpotWithPriceLimit, you must specify the SpotPriceLimit parameter.

SpotDuration Integer No 1

The protection period of the preemptible instance. Unit: hours. Default value: 1. Valid values: 0 to 6.

Response parameters

Parameter Type Example Description
RequestId String 6829735A-FF76-58C6-AECB-27CBF135A7AA

The ID of the request.

AvailableZones Array of AvailableZone

An array of zones in which the specified resources are available.

AvailableZone
RegionId String cn-hangzhou

The ID of the region.

ZoneId String cn-hangzhou-e

The ID of the zone.

AvailableResources Array of AvailableResource

An array of the resources available in the specified zone.

AvailableResource
Type String InstanceTypeFamily

The type of the resource. Valid values:

  • InstanceTypeFamily: instance families.
  • InstanceType: instance types.
SupportedResources Array of SupportedResource

An array of resources available in the zones.

SupportedResource
Value String ecs.c6

The ECS instance types or instance families that are supported in the zones.

  • If the return value of the Type parameter is InstanceTypeFamily, this parameter indicates instance families that are returned.
  • If the return value of the Type parameter is InstanceType, this parameter indicates instance types that are returned.

Examples

Sample requests

https://eci.aliyuncs.com/?Action=DescribeAvailableResource
&RegionId=cn-hangzhou
&ZoneId=cn-hangzhou-e
&DestinationResource={"Category":"InstanceTypeFamily"}
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeAvailableResourceResponse>
    <RequestId>6829735A-FF76-58C6-AECB-27CBF135A7AA</RequestId>
    <AvailableZones>
        <AvailableZone>
            <ZoneId>cn-hangzhou-e</ZoneId>
            <AvailableResources>
                <AvailableResource>
                    <Type>InstanceTypeFamily</Type>
                    <SupportedResources>
                        <SupportedResource>
                            <Value>ecs.e3</Value>
                        </SupportedResource>
                        <SupportedResource>
                            <Value>ecs.n2</Value>
                        </SupportedResource>
                        <SupportedResource>
                            <Value>ecs.n1</Value>
                        </SupportedResource>
                    </SupportedResources>
                </AvailableResource>
            </AvailableResources>
            <RegionId>cn-hangzhou</RegionId>
        </AvailableZone>
    </AvailableZones>
</DescribeAvailableResourceResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "6829735A-FF76-58C6-AECB-27CBF135A7AA",
  "AvailableZones" : {
    "AvailableZone" : [ {
      "ZoneId" : "cn-hangzhou-e",
      "AvailableResources" : {
        "AvailableResource" : [ {
          "Type" : "InstanceTypeFamily",
          "SupportedResources" : {
            "SupportedResource" : [ {
              "Value" : "ecs.e3"
            }, {
              "Value" : "ecs.n2"
            }, {
              "Value" : "ecs.n1"
            } ]
          }
        } ]
      },
      "RegionId" : "cn-hangzhou"
    } ]
  }
}

Error codes

For a list of error codes, visit the API Error Center.