GetEcsQuotaUsage

Updated at:

Queries the planned and actual resource usage of Elastic Compute Service (ECS) quotas for the tenant and region of the current call. You can aggregate CPU and memory metrics by average or maximum value. The maximum query time range is 7 days.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

odps:GetEcsQuotaUsage

get

*Quota

acs:odps:{#regionId}:{#accountId}:quotas/{#nickName}

None None

Request syntax

GET /api/v1/quotas/ecs/{nickname}/usage HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

nickname

string

Yes

The name of the ECS quota. This name is used to locate the request path and permission resources. The usage is calculated based on the tenant and region of the current call.

example_ecs_quota

Request parameters

Parameter

Type

Required

Description

Example

tenantId

string

No

The tenant ID. The server uses the tenant associated with the current call.

123456

region

string

No

The region ID. The server uses the region in the context of the current call.

cn-hangzhou

from

integer

Yes

The start time of the query. The time is a UNIX timestamp in seconds.

1793520000

to

integer

Yes

The end time of the query. The time is a UNIX timestamp in seconds. The end time must be later than the start time, and the time range cannot exceed 7 days.

1793523600

aggMethod

string

No

The metric aggregation method. Valid values: avg (average value, default) and max (maximum value).

avg

subQuotaNickname

string

No

The name of the sub-quota. The current implementation aggregates data by tenant and region. This parameter is not used for filtering.

example_subquota

Response elements

Element

Type

Description

Example

object

The API response, which includes the request ID and ECS quota usage.

requestId

string

The request ID. You can use this ID to locate server call logs.

EFAB5AA9-394A-5B28-81FB-A32F03C4DD13

httpCode

integer

The HTTP status code.

400

errorCode

string

The error code returned when the call fails.

InvalidParameter

errorMsg

string

The error message returned when the call fails.

The specified parameter is invalid.

data

object

The metric data and chart configurations for ECS quota usage.

metrics

object

The time series of ECS quota usage, including the sampling time and the corresponding planned and actual resource usage.

{"timestamps":[1726790400000],"planCount":[16],"runningCount":[12],"planCountMem":[64],"runningCountMem":[48]}

plot

array<object>

The chart configurations used to display CPU and memory usage.

object

The configuration of a single resource chart.

title

string

The title of the chart.

CPU resources

type

string

The resource type of the chart. Valid values: cpu (CPU) and memory (memory).

cpu

yAxis

array

The name of the metric displayed in the chart.

string

The name of a metric displayed in the chart.

planCount

Examples

Success response

JSON format

{
  "requestId": "EFAB5AA9-394A-5B28-81FB-A32F03C4DD13",
  "httpCode": 400,
  "errorCode": "InvalidParameter",
  "errorMsg": "The specified parameter is invalid.",
  "data": {
    "metrics": {
      "timestamps": [
        1726790400000
      ],
      "planCount": [
        16
      ],
      "runningCount": [
        12
      ],
      "planCountMem": [
        64
      ],
      "runningCountMem": [
        48
      ]
    },
    "plot": [
      {
        "title": "CPU resources",
        "type": "cpu",
        "yAxis": [
          "planCount"
        ]
      }
    ]
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.