Manage Resource Quotas
This document introduces billing and quota management for CloudBase environments, including the overrun pay-as-you-go switch, renewal, plan changes, package queries, usage queries, and environment destruction, helping you control costs and ensure online business continuity.
For environment creation and package selection, see Enable and create your first environment.
Overrun Pay-As-You-Go Switch
Key reminder: if you did not pass EnableOverrun: "TRUE" when purchasing the environment, be sure to enable it. When overrun pay-as-you-go is not enabled, the environment will be suspended directly once the resources in the package are exhausted, and all services such as databases, cloud functions, and cloud storage become unavailable, causing requests from online users to fail.
There are two ways to enable it:
- Enable at purchase (recommended): pass
EnableOverrun: "TRUE"in the CreateEnv request, getting it done in one step. - Enable after purchase: enable or disable the overrun-to-pay-as-you-go feature through the API for modifying environment additional info, passing
EnvIdandEnableOverrun(valuesTRUE/FALSE). If using the Management SDK, you can passEnableExcess: trueincreateBillingDeal; see Management SDK - env APIs.
After enabling overrun pay-as-you-go, usage beyond the package quota automatically switches to pay-as-you-go billing without affecting business. It is strongly recommended to enable this feature for all production environments.
Renew Environments
Before an environment expires, call the RenewEnv API to renew it. The API automatically places an order and makes the payment.
Key parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
EnvId | Yes | String | Environment ID |
Period | No | Integer | Renewal period, unit: months, default 1 |
AutoVoucher | No | Boolean | Whether to automatically use vouchers, default false |
Tip: it is recommended to renew at least 3 days before expiration to avoid the environment being suspended due to arrears. This API automatically deducts payment from the Tencent Cloud account balance.
Change Package (Plan Change)
When business scale changes, you can upgrade or adjust the environment package through the ModifyEnvPlan API.
Key parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
EnvId | Yes | String | Environment ID |
PackageId | Yes | String | Target package ID, obtained through Query available packages |
AutoVoucher | No | Boolean | Whether to automatically use vouchers |
Note: plan changes involve settling the fee difference; make sure the account balance is sufficient. The upgrade takes effect immediately after the package is upgraded.
Query Available Packages
Query the currently available package list through the DescribeEnvPlans API to get detailed information such as package ID (PackageId), price, and resource quotas. When changing plans, use this API to get the target package ID.
Key parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
PackageId | No | String | English identifier of the package; if not specified, all available packages are returned. Example: baas_integration |
The returned PlanList is an array of PlanInfo structures with the main fields:
| Field | Type | Description |
|---|---|---|
PackageId | String | English identifier of the package |
PackageTitle | String | Package name |
PackageType | String | Package type |
PackageDescription | String | Package description |
UnitPrice | String | Unit price |
ResourceLimit | String | Resource limits (JSON string, including QPS, credits, etc.) |
BillTags | String | Billing tag info (JSON string) |
Query Environment Billing Cycle
Before querying resource usage, first get the start and end dates of the environment's billing cycle through DescribeEnvAccountCircle, to ensure usage statistics align with the billing cycle.
Key parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
EnvId | Yes | String | Environment ID |
WithHistoryCircle | No | Boolean | false returns only the current billing cycle (default); true additionally returns historical cycles |
The returned
StartTimeandEndTimecan be used directly as theStartDate/EndDateparameters of the DescribeCreditsUsage and DescribeCreditsUsageDetail APIs, ensuring usage queries align precisely with the billing cycle.
Query Resource Usage
Usage Summary
Query the overall credit consumption summary of the environment through the DescribeCreditsUsage API, including package quota deduction, resource pack deduction, and overrun pay-as-you-go portions.
Key parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
EnvId | Yes | String | Environment ID |
StartDate | Yes | String | Start date, format: YYYY-MM-DD; it is recommended to get it from Query environment billing cycle |
EndDate | Yes | String | End date, format: YYYY-MM-DD |
Tip: if
ReportValue > 0in the response, it means the package quota has been exceeded and overrun pay-as-you-go charges are being incurred. It is recommended to upgrade the package or purchase resource packs in time.
Usage Details
Query the credit usage details of each module (databases, cloud functions, cloud storage, etc.) through the DescribeCreditsUsageDetail API. Used together with the usage summary, it enables multi-level usage analysis.
Key parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
EnvId | Yes | String | Environment ID |
Modules | Yes | Array of String | List of modules to query. Possible values: EKS (CloudBase Run), Database (database), SCF (cloud function), COS (cloud storage), AI (AI services), HOSTING (static hosting), Auth (identity authentication), Other (others) |
StartDate | Yes | String | Start date, format: YYYY-MM-DD |
EndDate | Yes | String | End date, format: YYYY-MM-DD |
NeedUsageDetails | Yes | Boolean | Whether daily usage details are needed. true returns details, false returns only the summary |
Tip: it is recommended to query resource usage regularly to understand the consumption of each module in a timely manner and plan package resources reasonably.
Destroy Environments
Destroy a CloudBase environment through the DestroyEnv API. Environment destruction follows the lifecycle of Tencent Cloud prepaid (monthly subscription) products and is divided into two steps:
- Resource refund: after calling the API, the corresponding fees are automatically refunded based on the remaining validity period of the environment (vouchers are not refunded). After the refund, the environment enters an isolation period.
- Environment deletion: the environment is automatically deleted 15 days after entering the isolation period. You can also force-delete an environment in the isolation period by specifying
IsForce=true.
Key parameters:
| Parameter | Required | Type | Description |
|---|---|---|---|
EnvId | Yes | String | Environment ID |
IsForce | No | Boolean | For prepaid environments, pass true to delete an environment in isolation; calling on a normal environment triggers the refund flow and enters the isolation period. Default false |
BypassCheck | No | Boolean | Whether to bypass resource checks (such as resource packs and other additional resources). When true, resources are deleted directly without checking whether they contain data. Default false |
Common error codes:
| Error code | Description |
|---|---|
ResourceUnavailable.InvoiceAmountLack | Insufficient current invoice balance to refund |
ResourceUnavailable.ResourceOverdue | Resource overdue |
Warning: after the environment is refunded, it enters the isolation period and all resources become inaccessible; after the environment is completely deleted, all data cannot be recovered. Please operate with caution. Destruction is irreversible; it is recommended to back up data before operating. To understand the current status of the environment, you can first query it through DescribeEnvs.
FAQ
Q1: How do I view the expiration time of an environment?
Call the DescribeBillingInfo API and pass in the environment ID to get the billing status, expiration time, and other information.
Q2: How soon after purchasing an environment can it be used?
In general, an environment is created within 1-3 minutes. You can query the environment status through the DescribeEnvs API; when Status is NORMAL, the environment is ready.
Q3: Will the environment be deleted after the package expires?
After the package expires, the environment first enters a suspended state (resources are retained) and is only completely destroyed after the retention period. It is recommended to renew in time before expiration.
Q4: Can I change from another package to the Integration package?
Yes. Through the ModifyEnvPlan API, set PackageId to the Integration package ID. The price difference from the plan change will be automatically deducted from the account balance.
Q5: What happens if I don't enable the overrun pay-as-you-go switch?
The environment will be suspended directly once the resources in the package are exhausted, and all services (databases, cloud functions, cloud storage, etc.) become unavailable, causing requests from online users to fail. It is recommended to pass EnableOverrun: "TRUE" directly in the CreateEnv request when purchasing, getting it done in one step; if it was not set at purchase, you can also enable it later as described in the overrun pay-as-you-go switch section. After enabling, usage beyond the package will be billed pay-as-you-go, without affecting business.
Q6: How are credits for the Integration package calculated?
Credits are the unified metering unit of CloudBase, covering database read/write, cloud function invocations, cloud storage traffic, and more. The specific quota is subject to the Credits.MaxSize field in the ResourceLimit returned by DescribeEnvPlans. For credit conversion rules, see the credits price documentation.
API Reference
| API | Purpose | Documentation |
|---|---|---|
ModifyEnvExtra (or SDK createBillingDeal) | Enable / disable overrun pay-as-you-go | Management SDK - env APIs |
RenewEnv | Renew environment | Renew a CloudBase environment |
ModifyEnvPlan | Change package (plan change) | Update a CloudBase environment package |
DescribeEnvPlans | Query available packages | Query environment package info |
DescribeEnvAccountCircle | Query environment billing cycle | Query the current billing cycle of an environment |
DescribeCreditsUsage | Query credit usage summary | Get credit usage |
DescribeCreditsUsageDetail | Query credit usage details | Get credit usage details |
DescribeBillingInfo | Query environment billing info | Query environment billing info |
DestroyEnv | Destroy environment | Destroy an environment |