Basic Environment
Environment Management
View Environment List
View all TCB environment information:
tcb env list
The Environment ID is the unique identifier of the environment and is globally unique. The environment name can be customized and is used to distinguish between different environments.
Status represents the environment status. Only when the status is normal can you operate resources such as functions, databases, storage, etc. Newly created environments may be in the initialization state; please wait patiently.
Environment ID Resolution Priority
CloudBase CLI v3.0.0 introduced global default environment configuration (tcb env use). The environment ID resolution priority is (low → high):
Global configuration (tcb env use) < Project cloudbaserc.json < Command line -e / --env-id
That is: the command line parameter -e always takes precedence, followed by the project cloudbaserc.json, and finally the global default environment.
Set Default Environment
Set the global default environment ID. After setting, subsequent commands can omit the -e parameter:
# Set Default Environment
tcb env use <envId>
# View Current Default Environment
tcb env use
# Clear Default Environment
tcb env use --unset
Modify Environment Alias
Modify the alias for the TCB environment:
tcb env rename <name> -e <envId>
Create Environment
Creating a new TCB environment:
# Interactive Creation (displays optional package list when no parameters are provided)
tcb env create
# Create with specified parameters
tcb env create --alias <Alias> --package <PackageId> --region ap-shanghai --duration 1
Command Parameters:
| Parameter | Description | Default Value |
|---|---|---|
--alias <alias> | Environment alias | — |
--package <package> | Package ID, see the package list below; if not filled, the package list will be displayed for selection. | — |
--region <region> | Environment region | ap-shanghai |
--duration <duration> | Subscription duration (months), optional values: 1-12, 24 | 1 |
--auto-renew | Enable auto-renewal | No |
--yes | Non-interactive mode, skip confirmation prompts | — |
Package ID Reference:
| Package ID | Package Name | Applicable Scenarios |
|---|---|---|
baas_personal | Personal Edition | Entry-level for beginners, cost-effective |
baas_pf_standard | Standard Edition | Small teams |
baas_pf_enterprise | Enterprise Edition | Small and medium-sized enterprises (SMEs) |
For package prices and detailed quotas, see the TCB pricing page.
Change Package
Modify environment package (upgrade/downgrade):
# Interactive Modification (displays modifiable package list when only envId is input)
tcb env modify -e <envId>
# Specify Target Package
tcb env modify --package <Package Id or number> -e <envId>
| Parameter | Description |
|---|---|
--package <package> | Target package ID or number (same as the package list above; if not specified, the modifiable package list will be displayed) |
-e, --env-id <envId> | TCB environment ID |
--yes | Skip confirmation prompts |
Renew Environment
Renewing TCB environment:
tcb env renew -e <envId>
# Specify renewal duration
tcb env renew --duration 3 -e <envId>
| Parameter | Description | Default Value |
|---|---|---|
--duration <duration> | Renewal duration (months) | 1 |
-e, --env-id <envId> | TCB environment ID | — |
--yes | Skip confirmation prompts | — |
Terminate Environment
Terminate TCB environment (This operation is irreversible, so proceed with caution):
tcb env delete -e <envId>
# Preview termination impact scope (without actual execution)
tcb env delete -e <envId> --dry-run
# Skip confirmation
tcb env delete -e <envId> --yes
Command Parameters:
| Parameter | Description |
|---|---|
-e, --env-id <envId> | Environment ID (required) |
--yes | Skip confirmation prompts |
--dry-run | Perform a dry run, only displaying environment information and impact scope without actual termination |
Terminating an environment will delete all resources under it (SCF, databases, storage, etc.). This operation is irreversible. We recommend previewing the impact using --dry-run first.
View Resource Usage
View environment resource usage details:
tcb env usage -e <envId>
View Resource Metrics Details
View environment resource metrics usage details, supports filtering by time range:
tcb env info -e <envId>
# Specify time range
tcb env info -e <envId> --start-date 2025-01-01 --end-date 2025-01-31
| Parameter | Description |
|---|---|
--start-date <date> | Start date, format: YYYY-MM-DD |
--end-date <date> | End date, format: YYYY-MM-DD |
-e, --env-id <envId> | TCB environment ID |
--yes | Skip confirmation prompts |
Security Domain Management
Security Domain Management has been migrated to the standalone tcb cors command, offering more complete features. It is recommended to use the new command. For details, see Security Domain Management.
The following commands are still available (retained for compatibility):
View Security Domain
tcb env domain list -e <envId>
Add Security Domain
tcb env domain create <domain> -e <envId>
Delete Security Domain
tcb env domain delete -e <envId>
Command Quick Reference
| Command | Description | Version |
|---|---|---|
tcb env list | List environments | v1+ |
tcb env use <envId> | Set the global default environment | v3.0.0+ |
tcb env use --unset | Clear the global default environment | v3.0.0+ |
tcb env rename <name> | Rename the environment | v1+ |
tcb env create | Create a new environment | v3.0.0+ |
tcb env modify | Modify the environment plan | v3.0.0+ |
tcb env renew | Renew the environment | v3.0.0+ |
tcb env delete | Terminate an environment | v3.0.0+ |
tcb env usage | View resource usage | v3.0.0+ |
tcb env info | View resource metric details | v3.0.0+ |