Skip to main content

tcb domains add

Bind a custom domain to the HTTP gateway. Afterwards the domain serves CloudBase resources, and routes forward traffic to functions, CloudBase Run services, or static hosting.

v3.0.0+

tcb domains has been available since v3.0.0.

Usage​

tcb domains add <domain> --certid <certId> [options]

Parameters​

ParameterRequiredDescriptionDefault
<domain>YesDomain to bind—
--certid <certId>YesSSL certificate ID from the Tencent Cloud SSL console—
--access-type <type>NoDIRECT / CDN / CUSTOM / EODIRECT
--custom-cname <cname>NoCustom CNAME, --access-type CUSTOM only—
--disableNoBind the domain in a disabled statefalse
-e, --env-id <envId>NoEnvironment IDenvId in the configuration
--platform-id <platformId>NoPlatform edition pool ID, mutually exclusive with -e (v3.8.3+)—

Examples​

# Direct access (default)
tcb domains add api.example.com --certid <certId> -e <envId>

# CDN access
tcb domains add api.example.com --certid <certId> --access-type CDN -e <envId>

# Custom access with a CNAME origin
tcb domains add api.example.com --certid <certId> --access-type CUSTOM --custom-cname origin.example.com -e <envId>

# Bind as disabled
tcb domains add api.example.com --certid <certId> --disable -e <envId>

# Bind inside a platform edition pool (v3.8.3+)
tcb domains add api.example.com --certid <certId> --platform-id <platformId>

Prerequisites​

  1. The domain has a valid ICP filing
  2. A valid certificate was uploaded in the Tencent Cloud SSL console and its ID is at hand
  3. After binding, point the domain CNAME record at the CloudBase environment domain

Notes​

  • A domain cannot be bound twice
  • DNS resolution must be configured before the domain works
  • Routes can only be attached after a domain is bound, see Create a route