Multi-Region Support
Starting from CLI version 1.2.0, CloudBase CLI supports multi-region resource operations, allowing you to easily manage CloudBase environments and resources across different regions through the command line.
Quick Start
Default Region
By default, the CLI operates on environments in the Shanghai region (ap-shanghai). If your environment is in Shanghai, no additional configuration is required.
Specifying a Region
When you need to operate on environments in other regions, use the -r global parameter to specify the region:
# View environment list in Guangzhou region
tcb env list -r gz
# Deploy function to Guangzhou region
tcb fn deploy myFunction -r gz -e your-env-id
The -r parameter is a global parameter and applies to all CLI commands
Supported Regions
The following table lists the currently supported regions and their abbreviations:
| Region | Abbreviation | Full Identifier | Description |
|---|---|---|---|
| Guangzhou | gz | ap-guangzhou | South China |
| Beijing | bj | ap-beijing | North China |
| Shanghai | sh | ap-shanghai | East China (default) |
- When using the CLI, you can use either the abbreviation (e.g.,
gz) or the full identifier (e.g.,ap-guangzhou)
Configuration File Method
Specifying Region in Configuration File
You can specify the environment region in the cloudbaserc.json configuration file, eliminating the need to add the -r parameter each time:
{
"version": "2.0",
"envId": "your-env-id",
"region": "ap-guangzhou",
"functionRoot": "./functions",
"functions": [
{
"name": "app",
"timeout": 5,
"runtime": "Nodejs16.13"
}
]
}