Skip to main content

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:

ParameterDescription
--enable-public-accessAllow public access
--disable-public-accessBlock public access; the default domain returns 403 to public requests

VPC access:

ParameterDescription
--enable-vpc-accessAllow VPC access
--disable-vpc-accessBlock VPC access

VPC whitelist:

ParameterDescription
--vpc-whitelist <vpcs...>Replace the whitelist. Format vpcId@region, comma-separated or repeated
--enable-vpc-whitelistEnable the whitelist; allows the VPCs in the current list
--disable-vpc-whitelistDisable the whitelist, keep the list, allow all VPCs
Whitelist behavior
  • --vpc-whitelist only 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