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

Using the KooCLI

Huawei Cloud Koo Command Line Interface (KooCLI, formerly HCloud CLI) is a command-line management tool designed for cloud service APIs published on API Explorer. You can use this tool to call the APIs exposed by Cloud Search Service (CSS) on API Explorer to manage and use your CSS resources. For detailed information about KooCLI, see What is KooCLI?

Installing KooCLI

Before using KooCLI, you need to install it first. KooCLI supports three operating systems: Windows, Linux, and macOS. Install the corresponding version of the tool based on the operating system of your host.

Configuring KooCLI Initialization

When using KooCLI to call APIs, you need to obtain the caller's identity information for authentication. By configuring KooCLI initialization, you can store the permanent AK/SK information in a configuration file, avoiding the need to frequently enter this fixed information when calling APIs.

You can skip this step if you prefer not to pass authentication information through a configuration file but instead pass authentication-related parameters directly in the command. For detailed operations, 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 perform initialization 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.

    After completion, the system displays a message indicating successful initialization configuration.

Generating and Executing CLI Commands

KooCLI supports two command generation methods:

  • Quickly generate and obtain CLI commands for calling APIs through API Explorer. You are advised to obtain CLI commands via API Explorer for greater convenience and speed.
  • Query the operation commands and related parameter information of the API through CLI commands, then manually assemble the CLI command to call the API. For detailed operations, see Step 4: View and Run Cloud Service Operation Commands.

The following uses CSS's list clusters API as an example to describe how to generate a CLI command from API Explorer and then execute the CLI command to call the API.

  1. On the API Explorer page, select the API for which you want to generate a CLI command.
  2. In the parameter configuration interface in the middle, fill in the parameters required to call the API.
  3. In the right pane, click the CLI Example tab to view the generated CLI command.

    An example of the CLI command for the list clusters API is as follows:

    hcloud CSS ListClustersDetails/v1 --cli-region="cn-north-4" --project_id="0f4bca096d80f3212f31c002eab9931d"
  4. Copy the generated CLI command and paste it into the CLI to execute.

    An example of the execution result of the CLI command for the list clusters API is as follows:

    {
      "totalSize" : 1,
      "clusters" : [ {
        "datastore" : {
          "type" : "elasticsearch",
          "version" : "7.10.2",
          "subVersion" : "7.10.2_24.3.0_0827",
          "isEosCluster" : false,
          "supportSecuritymode" : false
        },
        "instances" : [ {
          "status" : "200",
          "type" : "ess",
          "id" : "{INSTANCE_ID}",
          "name" : "css-8bc5-ess-esn-1-1",
          "specCode" : "ess.spec-4u8g",
          "azCode" : "{AZ_CODE}",
          "volume" : {
            "type" : "ULTRAHIGH",
            "size" : 40,
            "resourceIds" : [ "{RESOURCE_ID}" ]
          },
          "ip" : "192.168.0.122",
          "resourceId" : "{RESOURCE_ID}",
          "subnetId" : "{SUBNET_ID}"
        } ],
        "publicKibanaResp" : {
          "eipSize" : 10,
          "publicKibanaIp" : "100.95.152.28:9200",
          "bandwidthResourceId" : "18bec13f-5cc1-4631-867f-33505d15be12"
        },
        "elbWhiteList" : {
          "whiteList" : "",
          "enableWhiteList" : false
        },
        "updated" : "2023-10-09T02:07:13",
        "name" : "css-8bc5",
        "desc" : "csscluster",
        "snapshotPolicy" : {
          "backupEnable" : false,
          "bakPeriod" : "",
          "bakFrequency" : "",
          "bakKeepDay" : 1
        },
        "publicIp" : "100.85.222.202",
        "created" : "2023-10-09T02:07:13",
        "id" : "{CLUSTER_ID}",
        "status" : "200",
        "endpoint" : "192.168.0.122:9200",
        "vpcId" : "{VPC_ID}",
        "subnetId" : "{SUBNET_ID}",
        "currentSubnetIds" : "{SUBNET_ID}",
        "securityGroupId" : "{SECURITY_GROUP_ID}",
        "bandwidthResourceId" : "{BANDWIDTH_RESOURCE_ID}",
        "bandwidthSize" : 3,
        "httpsEnable" : true,
        "authorityEnable" : true,
        "diskEncrypted" : false,
        "backupAvailable" : false,
        "actionProgress" : { },
        "actions" : [ ],
        "enterpriseProjectId" : "0",
        "tags" : [ ],
        "period" : true
      } ]
    }