Skip to main content

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:

  1. Enable at purchase (recommended): pass EnableOverrun: "TRUE" in the CreateEnv request, getting it done in one step.
  2. Enable after purchase: enable or disable the overrun-to-pay-as-you-go feature through the API for modifying environment additional info, passing EnvId and EnableOverrun (values TRUE / FALSE). If using the Management SDK, you can pass EnableExcess: true in createBillingDeal; 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:

ParameterRequiredTypeDescription
EnvIdYesStringEnvironment ID
PeriodNoIntegerRenewal period, unit: months, default 1
AutoVoucherNoBooleanWhether 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:

ParameterRequiredTypeDescription
EnvIdYesStringEnvironment ID
PackageIdYesStringTarget package ID, obtained through Query available packages
AutoVoucherNoBooleanWhether 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:

ParameterRequiredTypeDescription
PackageIdNoStringEnglish 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:

FieldTypeDescription
PackageIdStringEnglish identifier of the package
PackageTitleStringPackage name
PackageTypeStringPackage type
PackageDescriptionStringPackage description
UnitPriceStringUnit price
ResourceLimitStringResource limits (JSON string, including QPS, credits, etc.)
BillTagsStringBilling 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:

ParameterRequiredTypeDescription
EnvIdYesStringEnvironment ID
WithHistoryCircleNoBooleanfalse returns only the current billing cycle (default); true additionally returns historical cycles

The returned StartTime and EndTime can be used directly as the StartDate / EndDate parameters 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:

ParameterRequiredTypeDescription
EnvIdYesStringEnvironment ID
StartDateYesStringStart date, format: YYYY-MM-DD; it is recommended to get it from Query environment billing cycle
EndDateYesStringEnd date, format: YYYY-MM-DD

Tip: if ReportValue > 0 in 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:

ParameterRequiredTypeDescription
EnvIdYesStringEnvironment ID
ModulesYesArray of StringList 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)
StartDateYesStringStart date, format: YYYY-MM-DD
EndDateYesStringEnd date, format: YYYY-MM-DD
NeedUsageDetailsYesBooleanWhether 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:

  1. 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.
  2. 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:

ParameterRequiredTypeDescription
EnvIdYesStringEnvironment ID
IsForceNoBooleanFor 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
BypassCheckNoBooleanWhether 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 codeDescription
ResourceUnavailable.InvoiceAmountLackInsufficient current invoice balance to refund
ResourceUnavailable.ResourceOverdueResource 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

APIPurposeDocumentation
ModifyEnvExtra (or SDK createBillingDeal)Enable / disable overrun pay-as-you-goManagement SDK - env APIs
RenewEnvRenew environmentRenew a CloudBase environment
ModifyEnvPlanChange package (plan change)Update a CloudBase environment package
DescribeEnvPlansQuery available packagesQuery environment package info
DescribeEnvAccountCircleQuery environment billing cycleQuery the current billing cycle of an environment
DescribeCreditsUsageQuery credit usage summaryGet credit usage
DescribeCreditsUsageDetailQuery credit usage detailsGet credit usage details
DescribeBillingInfoQuery environment billing infoQuery environment billing info
DestroyEnvDestroy environmentDestroy an environment