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
| Parameter | Required | Description | Default |
|---|---|---|---|
<domain> | Yes | Domain to bind | — |
--certid <certId> | Yes | SSL certificate ID from the Tencent Cloud SSL console | — |
--access-type <type> | No | DIRECT / CDN / CUSTOM / EO | DIRECT |
--custom-cname <cname> | No | Custom CNAME, --access-type CUSTOM only | — |
--disable | No | Bind the domain in a disabled state | false |
-e, --env-id <envId> | No | Environment ID | envId in the configuration |
--platform-id <platformId> | No | Platform 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
- The domain has a valid ICP filing
- A valid certificate was uploaded in the Tencent Cloud SSL console and its ID is at hand
- 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