Basic Environment
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
| Parameter | Description | Default Value |
|---|---|---|
--limit <limit> | Maximum number of environments to return, 1-100 | 20 |
--offset <offset> | Number of environments to skip | 0 |
- 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
--jsonoutput,metais{ limit, offset, hasMore }and does not include a total. When paging in scripts,hasMorebeingfalsemeans 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
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 CloudBase environment:
tcb env rename <name> -e <envId>
Create Environment
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:
| 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 |
--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 | — |
--yes | Non-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 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 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
- Specify all three parameters together. Passing only some of them fails with a parameter error, and no environment is created
- They apply to cloud storage only, not static hosting. The static hosting bucket is allocated by the platform when hosting is enabled and the CLI has no parameter for it; see Appendix: Shared COS Bucket (ExternalStorage)
- For the mechanism and field details, see Appendix: Shared COS Bucket (ExternalStorage)
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> | CloudBase environment ID |
--yes | Skip 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
| Parameter | Description |
|---|---|
--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
Renewing CloudBase 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> | CloudBase environment ID | — |
--yes | Skip confirmation prompts | — |
Terminate Environment
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:
| 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 |
--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
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:
| Command | What it shows |
|---|---|
tcb env detail | Which resources the environment is configured with (unique identifiers, region, etc.) |
tcb env usage | Resource usage summary |
tcb env info | Resource 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
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
| Parameter | Description |
|---|---|
--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-details | Show usage details |
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> | CloudBase 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 detail | View environment resource configuration details | v3.0.0+ |
tcb env usage | View resource usage | v3.0.0+ |
tcb env info | View resource metric details | v3.0.0+ |
env create/env modify/env delete/env usagesupport operating on Platform Edition resource pools via--platform-id <platformId>(v3.8.3+).