Help Center/ Koo Command Line Interface/ Getting Started/ Step 3: (Optional) Initialize Configurations
Updated on 2024-06-12 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 add a profile in non-interactive mode, see Adding or Modifying a Profile.

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, ap-southeast-1.

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/intl/en-us/usermanual-hcli/hcli_09.html'.
Access Key ID [required]: ********
Secret Access Key [required]: ****
Secret Access Key (again): ****
Region: ap-southeast-1

********************************************************
*****                                              *****
*****          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 versions earlier than 1.2.7 display sensitive information of query results in ciphertext. KooCLI 1.2.7 and later versions anonymize the sensitive information.

hcloud configure show --cli-profile=default

hcloud configure show --cli-profile=default
{
  "name": "default",
  "mode": "AKSK",
  "accessKeyId": "********",
  "secretAccessKey": "****",
  "securityToken": "",
  "region": "ap-southeast-1",
  "projectId": "",
  "domainId": "",
  "skipSecureVerify": "false",
  "readTimeout": 10,
  "connectTimeout": 5,
  "retryCount": 0
}