tcb env access set
Modify the access sources of the environment's default domain: public access, VPC access, and the VPC whitelist.
Supported on Enterprise and Platform Edition packages only; the command is available since v3.9.4. Only the items specified in this call are sent; other sources keep their current values.
Usage
tcb env access set [options]
Parameters
Public access:
| Parameter | Description |
|---|---|
--enable-public-access | Allow public access |
--disable-public-access | Block public access; the default domain returns 403 to public requests |
VPC access:
| Parameter | Description |
|---|---|
--enable-vpc-access | Allow VPC access |
--disable-vpc-access | Block VPC access |
VPC whitelist:
| Parameter | Description |
|---|---|
--vpc-whitelist <vpcs...> | Replace the whitelist. Format vpcId@region, comma-separated or repeated |
--enable-vpc-whitelist | Enable the whitelist; allows the VPCs in the current list |
--disable-vpc-whitelist | Disable the whitelist, keep the list, allow all VPCs |
Whitelist behavior
--vpc-whitelistonly replaces the list; it does not change the whitelist switch- Enabling the whitelist with an empty list blocks all VPCs
- The whitelist does not take effect while VPC access is
CLOSE
Confirmation
The command shows a current → target preview and asks for confirmation by default. --yes skips it; --yes is required with --json.
Examples
# Block public access
tcb env access set -e env-xxx --disable-public-access --yes
# Allow VPC access and set the whitelist
tcb env access set -e env-xxx --enable-vpc-access --enable-vpc-whitelist \
--vpc-whitelist vpc-aaa@ap-shanghai,vpc-bbb@ap-guangzhou
# Replace the whitelist only
tcb env access set -e env-xxx --vpc-whitelist vpc-ccc@ap-beijing
# Disable the whitelist and allow all VPCs
tcb env access set -e env-xxx --disable-vpc-whitelist
# Output in JSON format
tcb env access set -e env-xxx --disable-public-access --yes --json
Related Commands
- View Access Control
- Change Package: access control requires an Enterprise or Platform Edition package