All Products
Search
Document Center

Elastic Compute Service:API call throttling

Last Updated:Mar 29, 2024

To ensure the stability of Alibaba Cloud services and the fair use of cloud resources, Elastic Compute Service (ECS) throttles API calls to prevent malicious attacks and API abuses. This topic describes how to view the throttling information of ECS API operations and provides suggestions on how to throttle API calls.

View the throttling information of ECS API operations

To view the throttling thresholds of different ECS API operations, log on to the Quota Center console, click API Rate Limits in the left-side navigation pane, and then click Elastic Compute Service.

image.png

Note

You can view only the throttling thresholds of specific ECS API operations.

Throttling range

  • ECS uses a strict throttling mechanism to throttle API calls. The throttling mechanism is enabled for all ECS API operations. Region-specific throttling thresholds are defined for different API operations.

  • The number of calls to a specific API operation in a region cannot exceed a system-defined throttling threshold in the same Alibaba Cloud account. When the system-defined throttling threshold is reached, the system denies subsequent API calls that are initiated within a specific unit of time.

  • The number of calls to an API operation is calculated based on data traffic from the ECS console, Resource Access Management (RAM) users, self-managed platforms based on Alibaba Cloud accounts, and Infrastructure as a Service (IaaS) orchestration platforms such as Terraform and Ansible.

Throttling rules

Take note of the following API call throttling rules:

  • The number of calls to each API operation is independently calculated. If the number of calls to an API operation in a region reaches the throttling threshold, calls to other API operations and calls to the API operation in other regions are not affected.

  • If calls to an API operation are throttled at minute T, the operation cannot be called until minute T+1.

  • If calls to an API operation are throttled and an error is reported when you call the API operation by using an SDK or Alibaba Cloud CLI, invocations of the features that correspond to the API operation in the ECS console are also throttled.

  • When you call the CreateInstance or RunInstances operation to create one or more ECS instances, consider the limits on the amount of resources in addition to API call throttling. You can initiate API calls to create up to 5,000 ECS instances within 1 minute in an Alibaba Cloud account. If you initiate API calls to create a total of 5,000 ECS instances within 1 minute, the system may require more than 1 minute to create the instances and put the instances into the Running state.

Suggestions for throttling API calls

When the number of calls to an ECS API operation reaches the throttling threshold, the system reports the Throttling error code and cannot process API calls to the ECS API operation as expected. When you build an IaaS platform, consider the rationality of calling API operations. The following suggestions are provided:

  • Aggregate calls

    Some ECS API operations can be called to batch query resources or perform batch operations on resources. We recommend that you call the API operations to query multiple resources or perform operations on multiple resources at the same time.

  • Fix the call frequency

    If you want to call API operations to check the status of resources, we recommend that you call API operations at a specific interval or by using the reverse backoff mechanism. Examples:

    • In most cases, resource status, such as Starting and Stopping, is checked at intervals of 1 to 2 seconds.

    • In the reverse backoff mechanism, you do not check the status of a resource for several seconds after operations are performed on the resource, and then gradually increase the check frequency until a fixed interval of 1 to 2 seconds is reached.

  • Use the backoff retry policy

    If an error code is returned due to throttling when you call an API operation, configure a backoff retry policy for calls to the API operation. When you retry an API operation in the same Alibaba Cloud account, you can perform one query per second (QPS) to check whether the API operation is available.