Help Center/ Koo Command Line Interface/ Getting Started/ Step 3: (Optional) Initialize Configurations
Updated on 2023-02-27 GMT+08:00

Step 3: (Optional) Initialize Configurations

This section uses Windows as an example to describe how to use KooCLI. The methods for using the CLI in Linux and macOS are similar.

If you want to use KooCLI in non-configuration mode, skip this step. To configure parameters for another authentication mode in a profile, see Adding or Modifying Profiles.

The KooCLI initialization command is used to store the permanent AK/SK and region information you often use (see the following table) in the configuration file, eliminating the need for frequently entering the information during operations.

Table 1 Initialized parameters

Parameter

Description

Access Key ID

(Required) Access key ID (AK) of the access key (permanent AK/SK).

Secret Access Key

(Required) Secret access key (SK) of the access key (permanent AK/SK).

Region

(Optional) Region, for example, eu-west-101.

After typing in this command, press Enter to go to the interactive mode, and set the parameters as prompted.

hcloud configure init

hcloud configure init
Starting initialization. 'Secret Access Key' is anonymized. To obtain the parameter, see 'https://support.huaweicloud.com/eu/usermanual-hcli/hcli_09.html'.
Access Key ID [required]: H9NNF********SG65MXW
Secret Access Key [required]: ****
Secret Access Key (again): ****
Region: eu-west-101

********************************************************
*****                                              *****
*****          Initialization successful           *****
*****                                              *****
********************************************************
  • During initialization, you need to enter an SK for Secret Access Key twice. The value you enter is anonymized to ensure account security. The entered characters are displayed as asterisks (*) after you press Enter. After the configuration is complete, KooCLI encrypts sensitive authentication information in the profiles and saves the information to a local directory.
  • If you run the initialization command again, the existing configuration file is deleted and a new file is generated. The path for storing the new configuration file is as follows:
    • Windows OS: C:\Users\{Your Windows username}\.hcloud\config.json
    • Linux OS: /home/{Current username}/.hcloud/config.json
    • macOS: /Users/{Current username}/.hcloud/config.json

After initialization, you can run the following command to query the configuration information. KooCLI anonymizes the sensitive information of query results.

hcloud configure show --cli-profile=default

hcloud configure show --cli-profile=default
{
  "name": "default",
  "mode": "AKSK",
  "accessKeyId": "H9N****MXW",
  "secretAccessKey": "****",
  "securityToken": "",
  "xAuthToken": "",
  "expiresAt": "",
  "region": "eu-west-101",
  "projectId": "",
  "domainId": "",
  "skipSecureVerify": "false",
  "readTimeout": 10,
  "connectTimeout": 5,
  "retryCount": 0,
  "agencyDomainId": "",
  "agencyDomainName": "",
  "agencyName": "",
  "sourceProfile": ""
}