Skip to main content

Basic Environment

Environment Management​

Platform Edition Environment Management

The env create, env modify, env delete, and env usage commands support the Platform Edition: specifying --platform-id <platformId> (the Platform Edition resource pool ID) switches the command into Platform Edition mode; without it, normal mode behavior remains unchanged. The Platform Edition is an account-level package solution. For more information, see Platform Edition Overview.

View Environment List​

View all CloudBase environment information:

tcb env list

By default, 20 environments are shown at a time. If you have many environments, page through them with --limit / --offset:

# 50 per page, view page 2
tcb env list --limit 50 --offset 50
ParameterDescriptionDefault Value
--limit <limit>Maximum number of environments to return, 1-10020
--offset <offset>Number of environments to skip0
  • The range currently shown is printed below the table. When the page is full, the full command for the next page is also shown
  • In --json output, meta is { limit, offset, hasMore } and does not include a total. When paging in scripts, hasMore being false means you have reached the last page

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.

Region notes:

  • By default, environments in the current region are listed. Use --region <region> to query environments in a specific region, e.g., tcb env list --region ap-singapore
  • Standard regions: ap-shanghai (Shanghai), ap-singapore (Singapore)
  • ap-guangzhou (Guangzhou) is available on a whitelist basis; ap-beijing (Beijing) is not currently available

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 CloudBase environment:

tcb env rename <name> -e <envId>

Create Environment​

v3.0.0+

Creating a new CloudBase 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

# Create an environment under a Platform Edition resource pool (v3.8.3+, no package required)
tcb env create --platform-id <platformId> --alias <Alias> --yes

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
--external-storage-bucket <bucket>Name of the shared COS bucket used by cloud storage. Must be specified together with the next two parameters; see Use a Shared COS Bucket—
--external-storage-region <region>Region of the shared bucket, for example ap-shanghai—
--external-storage-base-path <basePath>Directory prefix of this environment in the shared bucket. Must be unique among environments in the same bucket—
--yesNon-interactive mode, skip confirmation prompts—
--platform-id <platformId>Platform Edition resource pool ID. When specified, an environment is created under the Platform Edition resource pool; mutually exclusive with --package / --region / --duration / --auto-renew / --postgresql—

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 CloudBase pricing page.

Use a Shared COS Bucket​

The number of COS buckets under one account has a quota. When you need to create many environments, their cloud storage can share one COS bucket, with each environment's files under its own directory prefix (BasePath):

tcb env create --alias tenant-a --package baas_personal --yes \
--external-storage-bucket my-bucket-1250000000 \
--external-storage-region ap-shanghai \
--external-storage-base-path tenant-a

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>CloudBase environment ID
--yesSkip confirmation prompts

Platform Edition environment status change (v3.8.3+): when --platform-id is specified, this command changes the Platform Edition environment status (enable/disable the environment, Cloud Storage / FlexDB resource status), mutually exclusive with --package; only explicitly specified fields are updated:

# Platform Edition: disable an environment
tcb env modify --platform-id <platformId> -e <envId> --status DISABLE --yes

# Platform Edition: set Cloud Storage to read-only
tcb env modify --platform-id <platformId> -e <envId> --storage-status READONLY --yes
ParameterDescription
--platform-id <platformId>Platform Edition resource pool ID. When specified, the Platform Edition environment status is changed
--status <status>Platform Edition environment status: ENABLE / DISABLE
--storage-status <status>Platform Edition Cloud Storage status: ENABLE (normal) / DISABLE (fully disabled) / READONLY (read-only)
--flexdb-status <status>Platform Edition FlexDB (document database) status: ENABLE (normal) / DISABLE (fully disabled) / READONLY (read-only)

Renew Environment​

v3.0.0+

Renewing CloudBase 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>CloudBase environment ID—
--yesSkip confirmation prompts—

Terminate Environment​

v3.0.0+

Terminate CloudBase 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
--platform-id <platformId>Platform Edition resource pool ID. When specified, an environment under the Platform Edition resource pool is terminated; the resource pool itself and other environments are not affected (v3.8.3+)

Platform Edition Examples (v3.8.3+):

# Terminate a Platform Edition environment
tcb env delete --platform-id <platformId> -e <envId> --yes

# Preview Platform Edition termination impact scope
tcb env delete --platform-id <platformId> -e <envId> --dry-run
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 Environment Resource Configuration Details​

View the unique identifiers and configuration of each resource in the environment (Database, Storage, Cloud Functions, Static Hosting, Log Service):

tcb env detail -e <envId>

Example output:

🔧 Resource Configuration
📦 Database [Not enabled]
📁 Storage Bucket: 7072-prod-xxx-1326375956 Region: ap-shanghai
⚡ Cloud Functions [Not enabled]
🌐 Static Hosting [Not enabled]
📊 Log Service [Not enabled]

Difference from env usage / env info:

CommandWhat it shows
tcb env detailWhich resources the environment is configured with (unique identifiers, region, etc.)
tcb env usageResource usage summary
tcb env infoResource metric details (by time range)

Region note: An environment belongs to a specific region. If the query returns empty or reports "environment not found", the region may not match. Retry with -r <region>, for example tcb env detail -e <envId> -r ap-singapore.

View Resource Usage​

v3.0.0+

View environment resource usage details:

tcb env usage -e <envId>

Platform Edition environment usage query (v3.8.3+): when --platform-id is specified, this command queries the resource usage by type and resource point consumption of a Platform Edition environment; in this mode, the environment ID is required:

# Query Platform Edition environment usage
tcb env usage --platform-id <platformId> -e <envId> --yes

# Specify resource types (JSON output)
tcb env usage --platform-id <platformId> -e <envId> --resource-types Storage,Function --json --yes

# Specify a time range and show usage details
tcb env usage --platform-id <platformId> -e <envId> --start-date 2026-09-01 --end-date 2026-09-15 --need-details
ParameterDescription
--platform-id <platformId>Platform Edition resource pool ID. When specified, Platform Edition environment usage is queried
--start-date <date>Query start date, format YYYY-MM-DD
--end-date <date>Query end date, format YYYY-MM-DD
--resource-types <types>Resource types, multiple values separated by commas: Database / Function / Storage / HOSTING / Log / Gateway / Cloudrun / Token / EO, default all
--need-detailsShow usage details

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>CloudBase 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 detailView environment resource configuration detailsv3.0.0+
tcb env usageView resource usagev3.0.0+
tcb env infoView resource metric detailsv3.0.0+

env create / env modify / env delete / env usage support operating on Platform Edition resource pools via --platform-id <platformId> (v3.8.3+).