Skip to main content

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

v3.0.0+

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

v3.0.0+

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

v3.0.0+

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:

ParameterDescriptionDefault 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 regionap-shanghai
--duration <duration>Subscription duration (months), optional values: 1-12, 241
--auto-renewEnable auto-renewalNo
--yesNon-interactive mode, skip confirmation prompts

Package ID Reference:

Package IDPackage NameApplicable Scenarios
baas_personalPersonal EditionEntry-level for beginners, cost-effective
baas_pf_standardStandard EditionSmall teams
baas_pf_enterpriseEnterprise EditionSmall and medium-sized enterprises (SMEs)

For package prices and detailed quotas, see the TCB pricing page.

Change Package

v3.0.0+

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>
ParameterDescription
--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
--yesSkip confirmation prompts

Renew Environment

v3.0.0+

Renewing TCB environment:

tcb env renew -e <envId>

# Specify renewal duration
tcb env renew --duration 3 -e <envId>
ParameterDescriptionDefault Value
--duration <duration>Renewal duration (months)1
-e, --env-id <envId>TCB environment ID
--yesSkip confirmation prompts

Terminate Environment

v3.0.0+

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:

ParameterDescription
-e, --env-id <envId>Environment ID (required)
--yesSkip confirmation prompts
--dry-runPerform a dry run, only displaying environment information and impact scope without actual termination
Caution

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

v3.0.0+

View environment resource usage details:

tcb env usage -e <envId>

View Resource Metrics Details

v3.0.0+

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
ParameterDescription
--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
--yesSkip confirmation prompts

Security Domain Management

tip

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

CommandDescriptionVersion
tcb env listList environmentsv1+
tcb env use <envId>Set the global default environmentv3.0.0+
tcb env use --unsetClear the global default environmentv3.0.0+
tcb env rename <name>Rename the environmentv1+
tcb env createCreate a new environmentv3.0.0+
tcb env modifyModify the environment planv3.0.0+
tcb env renewRenew the environmentv3.0.0+
tcb env deleteTerminate an environmentv3.0.0+
tcb env usageView resource usagev3.0.0+
tcb env infoView resource metric detailsv3.0.0+