Updated on 2026-09-01 GMT+08:00

How to Use 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 the open APIs of CFW to manage and use your CFW resources. For detailed information 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 tool of the corresponding version based on the OS used by your machine.

Initializing KooCLI Configuration

When KooCLI is used to call APIs, you need to obtain the caller's identity information for authentication. If you initialize KooCLI, your permanent AK/SK is stored in the configuration file, so you do not need to enter the credentials each time you call an API.

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 initialize KooCLI. The steps 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 command generation methods:

  • 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 API for querying the number of EIPs of CFW 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. In API Explorer, select Cloud Firewall for Cloud Service and then select EIP Management > ListEipCount from the API list.
  2. In the parameter configuration interface in the middle, enter the parameters required to call the API.
  3. In the pane on the right, click the CLI Example tab and view the generated CLI command.

    The following example shows the CLI command used to query the number of EIPs.

    hcloud CFW ListEipCount --cli-region="ap-southeast-1" --object_id="e75ef1c0-1e16-47bd-a38e-2cc6086ed5ae"
  4. Copy the generated CLI command and paste it into the CLI for execution.

    The following shows the execution output of CLI command for calling the API that is used to query the number of EIPs:

    {
      "data": {
        "eip_protected": 1,
        "eip_protected_self": 4,
        "eip_total": 5,
      }
    }