Advanced
Тема интерфейса

Step 3: (Optional) Initialize Configurations

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

If you want to use Cloud CLI in non-configuration mode, skip this step. To add a profile in non-interactive mode, see Adding or Modifying a Profile.

The Cloud CLI 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, ru-moscow-1.

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

cloud configure init

cloud configure init
Starting initialization. 'Secret Access Key' is anonymized. To obtain the parameter, see 'https://support.hc.sbercloud.ru/en-us/usermanual/cloudcli/hcli_09.html'.
Access Key ID [required]: H9NNF********SG65MXW
Secret Access Key [required]: ****
Secret Access Key (again): ****
Region: ru-moscow-1
********************************************************
***** *****
***** Initialization successful *****
***** *****
********************************************************
Note
  • 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, Cloud CLI 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}\.cloud\config.json
    • Linux OS: /home/{Current username}/.cloud/config.json
    • macOS: /Users/{Current username}/.cloud/config.json

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

cloud configure show --cli-profile=default

cloud configure show --cli-profile=default
{
"name": "default",
"mode": "AKSK",
"accessKeyId": "H9N****MXW",
"secretAccessKey": "****",
"securityToken": "",
"region": "ru-moscow-1",
"projectId": "",
"domainId": "",
"skipSecureVerify": "false",
"readTimeout": 10,
"connectTimeout": 5,
"retryCount": 0
}