Updated on 2024-08-20 GMT+08:00

Setting System Parameters in a Profile

The following are examples of setting system parameters in a profile.

  • Adding a profile

    When adding a profile, use --cli-profile to declare the profile name. For example:

    • Add a profile with AK/SK authentication mode. Authentication parameters: permanent AK (cli-access-key) and SK (cli-secret-key).
      hcloud configure set --cli-profile=testAKSK --cli-mode=AKSK --cli-region=ap-southeast-1 --cli-access-key=******** --cli-secret-key=******** --cli-project-id=068119468****************af89d2e --cli-domain-id=094518e46****************cfbc4c0 --cli-read-timeout=10 --cli-connect-timeout=5
    • Add a profile with AK/SK authentication mode. Authentication parameters: temporary AK (cli-access-key), SK (cli-secret-key), and SecurityToken (cli-security-token).
      hcloud configure set --cli-profile=testAKSKST --cli-mode=AKSK --cli-region=ap-southeast-1 --cli-access-key=******** --cli-secret-key=******** --cli-security-token=******** --cli-project-id=068119468****************af89d2e --cli-domain-id=094518e46****************cfbc4c0 --cli-read-timeout=10 --cli-connect-timeout=5

      For a profile with AK/SK authentication mode, if the cli-security-token parameter is configured in the profile, cli-access-key and cli-secret-key are temporary AK/SK. Otherwise, they are permanent AK/SK.

    • Add a profile with ecsAgency authentication mode. No authentication parameters are required.
      hcloud configure set --cli-profile=testEcsAgency --cli-mode=ecsAgency --cli-region=ap-southeast-1 --cli-read-timeout=10 --cli-connect-timeout=5

      When you use KooCLI to call cloud service APIs on an ECS, the CLI automatically obtains temporary authentication information based on the ECS agency.

    • Add a profile with SSO authentication mode. Authentication parameters: user portal URL (cli-sso-start-url), region of an IAM Identity Center instance (cli-sso-region), account name (cli-sso-account-name), and permission set name (cli-sso-permission-set-name). cli-sso-account-name and cli-sso-permission-set-name are optional.
      1. Create a profile that uses SSO authentication.
        hcloud configure set --cli-profile=testSSO --cli-mode=SSO --cli-region=ap-southeast-1 --cli-sso-start-url=https://idcenter.huaweicloud.com/d-3********6/portal --cli-sso-region=ap-southeast-1 --cli-sso-account-name=ACCOUNT_01 --cli-sso-permission-set-name=PERMISSION_01
      2. Log in with SSO. You will be prompted to enter an account name and permission set name if cli-sso-account-name and cli-sso-permission-set-name are not set in step 1.
        hcloud configure sso --cli-profile=testSSO
  • Changing the default profile
    If you have configured multiple profiles, you can run the following command to change the default profile:
    hcloud configure set --cli-profile=test
  • Changing the language
    This change will take effect for all profiles. Run the following command to change the language:
    hcloud configure set --cli-lang=cn
  • Switching between online and offline modes

    This change will take effect for all profiles. Run the following command to switch to the online mode:

    hcloud configure set --cli-offline=false
  • Configuring whether to display warnings

    This change will take effect for all profiles. Disabling warnings can avoid interfering with result resolution during command execution with automation scripts. To disable warnings, run the following command:

    hcloud configure set --cli-warning=false
  • Agreeing to the privacy statement

    This change will take effect for all profiles. When using KooCLI for the first time, you will be prompted to read and agree to the privacy statement. In some special scenarios such as command execution with automation scripts, run the following command to agree to the privacy statement:

    hcloud configure set --cli-agree-privacy-statement=true
  • Configuring whether to encrypt authentication information in the configuration file before storage

    This change will take effect for all profiles. Run the following command to skip encrypting authentication information in the configuration file before storage:

    hcloud configure set --cli-auth-encrypt=false
  • Changing the authentication mode of a profile
    A profile can contain parameters of multiple authentication modes. Run the following command to specify which authentication mode in a profile is to be used:
    hcloud configure set --cli-profile=test --cli-mode=AKSK
  • Changing the region of a profile
    hcloud configure set --cli-profile=test --cli-region=ap-southeast-1
  • Modifying the AK/SK of a profile

    AK and SK must be modified at the same time.

    hcloud configure set --cli-profile=test --cli-access-key=******** --cli-secret-key=********
  • Changing the project ID of a profile

    A project ID must be specified when you call the APIs of certain cloud services. To call these APIs, obtain project IDs and add those you will often use to a profile.

    hcloud configure set --cli-profile=test --cli-project-id=068119468****************af89d2e
  • Modifying the request connection timeout of a profile
    hcloud configure set --cli-profile=test --cli-connect-timeout=5
  • Modifying the I/O timeout of a profile
    hcloud configure set --cli-profile=test --cli-read-timeout=10
  • Modifying the maximum number of connection attempts of a profile
    hcloud configure set --cli-profile=test --cli-retry-count=3

    Setting the retry count with --cli-retry-count may cause idempotence and cyclic API calls. Exercise caution when using this option for resource creation APIs.

  • Changing the configuration of skipping HTTPS certificate verification in a profile
    hcloud configure set --cli-profile=test --cli-skip-secure-verify=true

You can modify multiple parameters of a profile at a time. For example, to modify cli-project-id and cli-region, run the following command:

hcloud configure set --cli-profile=test --cli-project-id=0681194*******************f89d2e --cli-region=ap-southeast-1