All Products
Search
Document Center

Elastic Container Instance:DescribeAvailableResource

Last Updated:Nov 14, 2024

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

Operation description

When you call the CreateContainerGroup operation to create an elastic container instance, you can use the InstanceType parameter to specify 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

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
RegionIdstringYes

The region ID of the ECS instance families.

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

cn-hangzhou
ZoneIdstringNo

The zone ID of the ECS instance families.

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

cn-hangzhou-e
DestinationResourceobjectYes

The information about the resource that you want to query.

CategorystringYes

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.
InstanceTypeFamily
ValuestringNo

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.
ecs.c6
CoresfloatNo

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

2
MemoryfloatNo

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

4
SpotResourceobjectNo

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

SpotStrategystringNo

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

  • NoSpot: The instance is created as a regular pay-as-you-go instance.
  • SpotWithPriceLimit: The instance is created as a preemptible instance with a user-defined maximum hourly price.
  • SpotAsPriceGo: The instance is created as 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. You must also use the Value parameter to specify instance types, or use the Cores and Memory parameters to specify the number of vCPUs and memory size.
SpotAsPriceGo
SpotPriceLimitdoubleNo

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.

0.2
SpotDurationintegerNo

The protection period of the preemptible instance. Unit: hours. Default value: 1. The value of 0 indicates no protection period.

1

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response

RequestIdstring

The request ID.

6829735A-FF76-58C6-AECB-27CBF135A7AA
AvailableZonesarray<object>

The zones in which the specified resources are available.

AvailableZoneobject
RegionIdstring

The region ID of the resources.

cn-hangzhou
ZoneIdstring

The zone ID of the resources.

cn-hangzhou-e
AvailableResourcesarray<object>

The resources that are available in the specified zone.

AvailableResourceobject
Typestring

The type of the resource. Valid values:

  • InstanceTypeFamily: instance families.
  • InstanceType: instance types.
InstanceTypeFamily
SupportedResourcesarray<object>

The information about the resources that are available in the zones.

SupportedResourceobject
Valuestring

The ECS instance types or instance families that are available 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.
ecs.c6
StatusCategorystring

The category of resources based on stock status. Valid values:

  • WithStock: Resources are in sufficient stock.
  • ClosedWithStock: Resources are insufficient. We recommend that you use instance types that are in sufficient stock.
  • WithoutStock: Resources are sold out and will be replenished. We recommend that you use instance types that are in sufficient stock.
  • ClosedWithoutStock: Resources are sold out and will not be replenished. We recommend that you use instance types that are in sufficient stock.
WithStock

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400MissingParameter%s-
400InvalidParameter%s-
403Spot.NotMatched%s. We recommend that you use the create multi-zone function to avoid insufficient inventory.We recommend that you use the create multi-zone function to avoid insufficient inventory.
404InvalidParameter.NotFound%s-

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-06-21The Error code has changedView Change Details