You can call this operation to query the price of an 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 No DescribeContainerGroupPrice

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

Cpu Float Yes 2.0

The number of vCPUs.

Memory Float Yes 4.0

The memory size.

RegionId String Yes cn-hangzhou

The region ID of the image cache.

InstanceType String No ecs.c5.large

The instance type of the Elastic Compute Service (ECS) instance used to create the elastic container instance.

SpotStrategy String No SpotWithPriceLimit

The preemption policy for the preemptible elastic container instance. Valid values:

  • NoSpot: The elastic container instance is a regular pay-as-you-go elastic container instance.
  • SpotWithPriceLimit: The elastic container instance is a preemptible elastic container instance that has a user-defined maximum hourly price.
  • SpotAsPriceGo: The elastic container instance is a preemptible elastic container instance whose price is based on the current market price.

Default value: NoSpot.

ZoneId String No cn-hangzhou-g

The zone ID of the elastic container instance.

SpotPriceLimit Float No 0.2

The maximum hourly price for the preemptible elastic container instance. The value can be accurate to three decimal places. When SpotStrategy is set to SpotWithPriceLimit, the SpotPriceLimit parameter must be specified.

EphemeralStorage Integer No 20

The size of the temporary storage space. Unit: GiB.

Response parameters

Parameter Type Example Description
PriceInfo Struct

The information about the price and discount rules.

Price Struct

The price.

Currency String CNY

The currency unit.

DetailInfos Array of DetailInfo

Details about the prices.

DetailInfo
DiscountPrice Float 0

The discount.

OriginalPrice Float 0.000098

The original price.

Resource String cpu

The name of the resource.

Rules Array of Rule

Details about the pricing rules.

Rule
Description String Get 15% off on a 1-year subscription

The description of the rule.

RuleId Long 587

The ID of the rule.

TradePrice Float 0.000098

The transaction price.

DiscountPrice Float 0

The discount.

OriginalPrice Float 0.00012252

The original price.

TradePrice Float 0.00012252

The final price after the discount.

Rules Array of Rule

The promotion rules.

Rule
Description String Get 15% off on a 1-year subscription

The description of the promotion rule.

RuleId Long 587

The ID of the rule.

SpotPrices Array of SpotPrice

Details about the spot price of the preemptible elastic container instance.

SpotPrice
InstanceType String ecs.c5.large

The instance type of the instance.

OriginPrice Float 0.622

The original price.

SpotPrice Float 0.056

The spot price of the preemptible elastic container instance.

ZoneId String cn-hangzhou-i

The zone ID of the elastic container instance.

RequestId String 7A872585-33C7-4D69-AB8E-412E81EBA387

The ID of the request.

Examples

Sample requests

https://eci.aliyuncs.com/?Action=DescribeContainerGroupPrice
&Cpu=2.0
&Memory=4.0
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

<DescribeContainerGroupPriceResponse>
      <RequestId>7A872585-33C7-4D69-AB8E-412E81EBA387</RequestId>
      <PriceInfo>
            <SpotPrices>
                  <SpotPrice>
                        <OriginPrice>0.622</OriginPrice>
                        <SpotPrice>0.056</SpotPrice>
                        <ZoneId>cn-hangzhou-i</ZoneId>
                        <InstanceType>ecs.c5.large</InstanceType>
                  </SpotPrice>
            </SpotPrices>
            <Rules>
                  <Rule>
                        <Description>Get 15% off on a 1-year subscription</Description>
                        <RuleId>587</RuleId>
                  </Rule>
            </Rules>
            <Price>
                  <OriginalPrice>0.00012252</OriginalPrice>
                  <Currency>CNY</Currency>
                  <DiscountPrice>0</DiscountPrice>
                  <TradePrice>0.00012252</TradePrice>
                  <DetailInfos>
                        <DetailInfo>
                              <OriginalPrice>0.000098</OriginalPrice>
                              <DiscountPrice>0</DiscountPrice>
                              <Resource>cpu</Resource>
                              <TradePrice>0.000098</TradePrice>
                              <Rules>
                                    <Rule>
                                          <Description>Get 15% off on a 1-year subscription</Description>
                                          <RuleId>587</RuleId>
                                    </Rule>
                              </Rules>
                        </DetailInfo>
                  </DetailInfos>
            </Price>
      </PriceInfo>
</DescribeContainerGroupPriceResponse>

JSON format

{
    "RequestId": "7A872585-33C7-4D69-AB8E-412E81EBA387",
    "PriceInfo": {
        "SpotPrices": {
            "SpotPrice": [{
                "OriginPrice": "0.622",
                "SpotPrice": "0.056",
                "ZoneId": "cn-hangzhou-i",
                "InstanceType": "ecs.c5.large"
            }]
        },
        "Rules": {
            "Rule": [{
                "Description":"Receive a 15% discount on a 1-year subscription",
                "RuleId": "587"
            }]
        },
        "Price": {
            "OriginalPrice": "0.00012252",
            "Currency": "CNY",
            "DiscountPrice": "0",
            "TradePrice": "0.00012252",
            "DetailInfos": {
                "DetailInfo": [{
                    "OriginalPrice": "0.000098",
                    "DiscountPrice": "0",
                    "Resource": "cpu",
                    "TradePrice": "0.000098",
                    "Rules": {
                        "Rule": [{
                            "Description":"Receive a 15% discount on a 1-year subscription",
                            "RuleId": "587"
                        }]
                    }
                }]
            }
        }
    }
}

Error codes

HTTP status code Error code Error message Description
400 InvalidParam.CpuOrMemorySpec The specified specification is invalid. The error message returned because the specified instance type is unavailable. You cannot query the price.
400 TradeBidCommodityNotMatch The trade ID and the commodity do not match. The error message returned because the trade ID and the commodity do not match.
403 Spot.NotMatched %s. We recommend that you use the create multi-zone function to avoid insufficient inventory. For more information, see https://help.aliyun.com/document_detail/157290.html %s. The error message returned because the resources are insufficient. We recommend that you specify multiple zones and instance types to avoid insufficient resources. For more information, see https://help.aliyun.com/document_detail/157290.html.

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