Configure a usage cap
To prevent unexpected charges from traffic spikes or malicious attacks, you can configure a usage cap. This feature limits the bandwidth, traffic, or number of HTTPS requests for an accelerated domain name, helping you control costs and minimize losses from unexpected usage surges.
Background
When you use Alibaba Cloud CDN to accelerate your services, you may encounter the following issues:
Sudden traffic surges: Your website or application traffic can increase dramatically in a short period due to trending topics or other events. This surge can cause your CDN bandwidth or traffic to exceed normal levels, resulting in high costs.
Malicious traffic attacks: Your services are targeted by a CC attack or DDoS attack. Attackers generate a massive volume of requests or consume significant bandwidth, disrupting your operations and causing major financial losses.
To help you proactively control costs and manage risks, Alibaba Cloud CDN provides the usage cap feature. You can set a threshold for the bandwidth, traffic, or number of HTTPS requests for an accelerated domain name. When usage in a statistical period reaches your configured threshold, CDN automatically takes the domain name offline to suspend the acceleration service and prevent further costs. This makes the feature a key tool for CDN cost management and security.
Feature overview
The usage cap feature includes three modes: bandwidth cap, traffic cap, and HTTPS requests cap. When a rule in any of these modes is triggered, the corresponding accelerated domain name is automatically taken offline. The service resumes automatically after the specified unblocking time.
Traffic cap
This mode cumulatively monitors the total traffic for a domain name over a specified period. The cap rule is triggered when the accumulated traffic exceeds the threshold that you set. This feature is ideal for users with a pay-by-traffic billing model, helping you keep costs within your budget.
Parameter | Description |
Statistical period | The period over which traffic usage is accumulated and compared with the threshold. Valid values: Every 5 minutes, Every hour, Before 24:00 of the current day, or This month. |
Threshold | The maximum total traffic allowed within one statistical period. If the accumulated traffic exceeds this threshold, the accelerated domain name is taken offline. Value range: 1 MB to 10,000 TB. |
Unblocking time | After the domain name is taken offline, the system starts a timer from the moment the cap is triggered. When the configured unblocking time is reached, the domain name is automatically brought back online to resume the CDN acceleration service. |
Bandwidth cap
This mode monitors the bandwidth usage of a domain name. When the bandwidth exceeds the threshold that you set, the cap rule is triggered. This feature is ideal for users with a pay-by-peak-bandwidth billing model, as it effectively controls the upper limit of your billable bandwidth.
Parameter | Description |
Threshold | The bandwidth cap for the domain name. If the bandwidth within a statistical period exceeds this threshold, the accelerated domain name is taken offline. Value range: 1 Mbit/s to 1 Tbit/s. |
Unblocking time | After the domain name is taken offline, the system starts a timer from the moment the cap is triggered. When the configured unblocking time is reached, the domain name is automatically brought back online to resume the CDN acceleration service. Valid values: 5 minutes, 1 hour, 1 day, 1 month, or Never. |
HTTPS requests cap
This mode cumulatively monitors the total number of HTTPS requests for a domain name over a specified period. When the accumulated number of requests exceeds the threshold that you set, the cap rule is triggered. This feature is useful for controlling spending on HTTPS requests within a strict budget.
Parameter | Description |
Statistical period | The period over which the number of HTTPS requests is accumulated and compared with the threshold. Valid values: Every 5 minutes, Every hour, Before 24:00 of the current day, or This month. |
Threshold | The maximum total number of HTTPS requests allowed within one statistical period. If the accumulated number of requests exceeds this threshold, the accelerated domain name is taken offline. Value range: 1 million to 10 billion requests. |
Unblocking time | After the domain name is taken offline, the system starts a timer from the moment the cap is triggered. When the configured unblocking time is reached, the domain name is automatically brought back online to resume the CDN acceleration service. |
Usage notes
Monitoring data latency: Usage monitoring data has a latency of about 10 minutes. As a result, the system takes the domain name offline about 10 minutes after usage reaches the threshold. You are billed for all resources, such as traffic, bandwidth, and requests, consumed during this delay.
Careful threshold evaluation: Once you configure a usage cap, the system takes your domain name offline if the threshold is reached. This disrupts all access through the CDN and causes all requests to fail. To avoid disrupting normal operations, always set a reasonable threshold based on historical business data and future expectations.
Automatic unblocking logic: After a domain name is taken offline because a usage cap is triggered, the system automatically starts a countdown based on the unblocking time you configured. During this period, even if you manually bring the domain name back online, the system still brings it online when the unblocking time elapses. If you want the domain name to remain offline after the cap is triggered, you must delete the usage cap configuration to prevent it from automatically coming back online.
Deleting a configuration vs. disabling the switch: A usage cap policy is active as long as its configuration record exists. Simply disabling the switch for the usage cap feature does not immediately stop the policy from being enforced. To completely remove the usage limit and prevent a domain name from being taken offline by a legacy configuration, you must go to the usage cap configuration page and delete the corresponding usage cap configuration, not just disable the switch.
Procedure
On the Domain Names page, find the domain name that you want to manage and click Manage in the Actions column.
-
In the domain's navigation pane, click Traffic Throttling.
On the Usage Cap tab, select the cap policy that you want to configure.
Click Modify Configuration and select a suitable statistical period, threshold, and unblocking time. For more information about the parameters, see Feature overview.
Click OK. The cap rule is created and takes effect immediately.
To delete an existing cap configuration, on the Usage cap tab, find the cap policy (Traffic Cap, Bandwidth Cap, or HTTPS Requests Cap) that you want to remove and click Delete. In the confirmation dialog box, click OK. The cap configuration is then deleted, and the system no longer enforces a limit for that usage metric.
You must delete the corresponding cap configuration record to ensure the usage limit is completely removed.
Offline behavior and recovery
When a domain name is automatically taken offline because a usage cap is triggered, the following occurs:
DNS resolution for the domain name may point to an invalid address, such as
offline.*.kunlun*.com, or return a614status code. As a result, your website becomes inaccessible.In the list of domain names in the CDN console, the status of the domain name changes to Disabled.
You can restore the service in one of two ways:
Wait for automatic recovery: The system starts a countdown based on your configured unblocking time. The domain name is automatically brought back online when the time elapses.
Manually enable the domain name: If you want to restore service sooner, you can find the domain name in the CDN console and click the Actions button in the Actions column to bring it back online.
If you want the domain name to remain offline after a cap is triggered and not be automatically brought back online, you must delete the usage cap configuration.

