Updated on 2026-08-27 GMT+08:00

Using KooCLI

Huawei Cloud Koo Command Line Interface (KooCLI), previously named "HCloud CLI", is designed to manage Huawei Cloud service APIs released on API Explorer. With KooCLI, you can call open APIs of SMS to manage and use your SMS resources. For details about KooCLI, see What Is KooCLI?

Installing KooCLI

Before using KooCLI, you need to install it. KooCLI is compatible with Windows, Linux, and macOS. Install the required version.

Initializing KooCLI Configuration

Your identity information is obtained for authentication when you use KooCLI to call APIs. By configuring KooCLI initialization, you can store your permanent AK/SK information in the configuration file. In this way, you do not need to frequently enter the information when calling APIs.

Skip this step if you intend to pass authentication parameters directly in commands instead of using the configuration file. For details, see Using KooCLI in Non-configuration Mode.

The following uses Windows as an example to describe how to initialize KooCLI configuration. The operations on Linux and macOS are similar. Before the initialization, obtain the AK/SK information. For details, see Access Keys.

  1. Open the CLI.
  2. Run the following command to initialize the configuration:
    hcloud configure init
  3. Enter the parameter values as prompted.
    Access Key ID [required]:      //Mandatory. Enter the AK.
    Secret Access Key [required]:      //Mandatory. Enter the SK. The system will anonymize the input.
    Secret Access Key (again):      //Mandatory. Enter the SK again. The system will anonymize the input.
    Region:      //Optional. Enter a region.

    The message "Initialization successful" is then displayed.

Generating and Executing CLI Commands

KooCLI supports two methods for generating commands:

  • Use API Explorer to quickly generate and obtain the CLI command for calling an API. This method is recommended as it is more convenient.
  • Use CLI commands to query API operations and related parameters, and then manually combine CLI commands to call APIs. For details, see Step 4: View and Run Cloud Service Operation Commands.

The following uses the CreateTask API of SMS as an example to describe how to generate a CLI command in API Explorer and then run the CLI command to call the API.

  1. On the Server Migration Service page in API Explorer, select the API for which you want to generate a CLI command.
  2. On the parameter configuration page in the middle, set the parameters required for calling the API.
  3. In the right pane, click the CLI Example tab to view the generated CLI command.
    The following is an example CLI command for creating a migration task:
    hcloud SMS CreateTask --cli-region="cn-north-4" --os_type="LINUX" --name="test" --source_server.id="xxxxx-xxx-xxxx" --type="MIGRATE_FILE"
  4. Copy the generated CLI command and paste it to the CLI for execution.

    The following is an example of the CLI command output for creating a migration task:

    {
        "id": "xxxxx-xxx-xxxx",
        "name": "test",
        "type": "MIGRATE_FILE",
        "os_type": "LINUX",
        "state": "READY",
        "priority": 1,
        "speed_limit": 0,
        "create_date": 1713600000000,
        "start_target_server": true
    }