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

Using KooCLI

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

Installing KooCLI

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

Configuring KooCLI Initialization

When KooCLI is used to call APIs, you need to obtain the caller's identity information for authentication. 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 fixed information during API calls.

Skip this step if you intend to pass authentication information 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 configure KooCLI initialization. The operations for Linux and macOS are similar. Before configuring initialization, you need to obtain the AK/SK information in advance. For detailed operations, see Access Keys.

  1. Open the CLI.
  2. Run the following command to configure initialization information:
    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 a CLI Command

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.

This section uses the API for creating a global accelerator as an example to describe how to generate a CLI command from API Explorer and then execute the command to call the API.

  1. On the API Explorer page of Global Accelerator, 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 calling the API to create a global accelerator.

    hhcloud GA CreateAccelerator --cli-region="cn-east-3" --accelerator.enterprise_project_id="0aad99bc-f5f6-4f78-8404-c598d76b0ed2" --accelerator.ip_sets.1.area="CM" --accelerator.ip_sets.1.ip_type="IPV4" --accelerator.name="acceleratorName" --accelerator.description="accelerator description" --accelerator.tags.1.value="tagValue" --accelerator.tags.1.key="tagKey"
  4. Copy the generated CLI command and paste it to the CLI for execution.

    The following is an example CLI command output for calling the API to create a global accelerator.

    {
      "accelerator" : {
        "id" : "ac1bf54f-6a23-4074-af77-800648d25bc8",
        "name" : "acceleratorName",
        "description" : "accelerator description",
        "status" : "ACTIVE",
        "ip_sets" : [ {
          "ip_type" : "IPV4",
          "ip_address" : "208.188.100.1",
          "area" : "CM"
        } ],
        "created_at" : "2019-01-08T01:21:37.151Z",
        "updated_at" : "2019-01-08T01:21:37.151Z",
        "domain_id" : "99a3fff0d03c428eac3678da6a7d0f24",
        "enterprise_project_id" : "0aad99bc-f5f6-4f78-8404-c598d76b0ed2",
        "flavor_id" : "00000000-0000-0000-0000-000000000000",
        "frozen_info" : {
          "status" : 2,
          "effect" : 1,
          "scene" : [ "ARREAR", "POLICE" ]
        },
        "tags" : [ {
          "key" : "tagKey",
          "value" : "tagValue"
        } ]
      },
      "request_id" : "915a14a6-867b-4af7-83d1-70efceb146f9"
    }