Skip to main content

Installation

npm (tag)

CloudBase CLI is the official command-line tool provided by CloudBase to help you quickly manage and deploy CloudBase resources.

Install CLI

Use your familiar package manager to install CloudBase CLI globally:

npm i -g @cloudbase/cli

Troubleshooting Installation Issues

If you encounter network timeout errors during installation (such as ETIMEOUT, network request failed, etc.), you can temporarily specify the Tencent Cloud npm mirror:

npm i -g @cloudbase/cli --registry=http://mirrors.cloud.tencent.com/npm/

Authentication

After installation, you need to log in to use CloudBase CLI. Choose the appropriate login method based on your use case:

💡 Recommended method, suitable for daily use by individual developers:

tcb login

The CLI will automatically open the CloudBase console to obtain authorization. Click the Agree to Authorize button in the browser to complete the login.

💡 Tip: If the browser does not open automatically, please manually copy the authorization link displayed in the terminal to your browser.

Getting Started

After logging in, you can start using CloudBase CLI.

AI-Assisted Development

Use AI features to quickly develop CloudBase applications:

tcb ai

View All Commands

View the complete list of commands supported by the CLI:

tcb -h

Sub-Account Authorization

If you need to use a Tencent Cloud sub-account to access CloudBase resources, the master account must first grant the appropriate permissions to the sub-account.

Authorization Steps

  1. Log in to the Tencent Cloud Access Management Console
  2. Select Users > User List from the left menu
  3. Click the Create User button
  4. Fill in the user information and complete the creation
  5. Select TCB preset authorization policies from the policy list
  6. Click Complete to finish creating the sub-account

💡 Tip: You can also associate policies with existing sub-accounts. For specific operations, please refer to the Authorization Management documentation.

Available Preset Policies

CloudBase provides the following preset policies for you to choose from:

Policy NameDescription
QcloudAccessForTCBRoleGrant CloudBase access to cloud resources
QcloudAccessForTCBRoleInAccessCloudBaseRunGrant CloudBase access to VPC, CVM and other cloud service resources (for CloudBase Run)
Permission Notice

The above policies contain full read and write permissions for resources such as object storage, cloud functions, logs, monitoring, VPC, etc. After granting these policies to a sub-account, the sub-account will have complete control over these resources and automatically gain access to subsequently added resources. Please grant authorization carefully.

If you need a sub-account to use the CLI tool's web authorization login method, you need to additionally grant CAM read-only permission:

Policy NameDescription
QcloudCamReadOnlyAccessGrant Cloud Access Management (CAM) read-only access

💡 Tip: If this policy is not granted, the sub-account can only log in to the CLI using the API Key method.

Advanced Configuration

Configure Network Proxy

If your terminal cannot directly access the public network, you can make the CLI work properly by setting an HTTP proxy. The CLI will automatically read the http_proxy or HTTP_PROXY environment variable.

Temporarily set proxy (valid for current terminal session):

export HTTP_PROXY=http://127.0.0.1:8000
Configuration Notice

http://127.0.0.1:8000 is only an example. Please configure the correct proxy address and port according to your actual network environment.

Permanently set proxy:

Add the above command to your terminal configuration file (such as ~/.bashrc, ~/.zshrc, etc.) to automatically apply the proxy configuration each time you open the terminal.