Updated on 2023-05-22 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=8NVT************KIOV --cli-secret-key=VHMQjoC**************************lsk3cGf --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=5FSU************607T --cli-secret-key=VoyjgLh**************************qRc8pSq --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 token authentication mode. Authentication parameter: access token (cli-x-auth-token).
      hcloud configure set --cli-profile=testToken --cli-mode=token --cli-region=ap-southeast-1 --cli-x-auth-token=******* --cli-project-id=068119468****************af89d2e --cli-domain-id=094518e46****************cfbc4c0 --cli-read-timeout=10 --cli-connect-timeout=5

      When you use a command prompt tool (such as cmd.exe) to run the preceding command, the command line may be incomplete if the value of cli-x-auth-token is too long. Therefore, check whether the command line content is complete before executing a command.

    • 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 agency authentication mode. Authentication parameters: delegating account name (cli-agency-domain-name) or ID (cli-agency-domain-id), agency name (cli-agency-name), and the profile (cli-source-profile) that stores the authentication information of the delegated account.
      1. Create a profile or use an existing one to store the authentication information of the delegated account. The profile uses AK/SK or token authentication.
        hcloud configure set --cli-profile=testAKSK --cli-mode=AKSK --cli-region=ap-southeast-1 --cli-access-key=8NVT************KIOV --cli-secret-key=VHMQjoC**************************lsk3cGf
      2. Create another profile that uses agency authentication. Use the profile configured in the previous step as the value of cli-source-profile.
        hcloud configure set --cli-profile=testAgency --cli-mode=agency --cli-region=ap-southeast-1 --cli-agency-domain-id=13534326******************5cf67b --cli-agency-name=****** --cli-source-profile=testAKSK --cli-read-timeout=10 --cli-connect-timeout=5

      When you add a profile with agency authentication mode, both cli-agency-domain-id (or cli-agency-domain-name) and cli-agency-name must be configured. The value of cli-profile cannot be the same as that of cli-source-profile in the command. The profile specified by cli-source-profile must exist.

  • 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
  • Changing the authentication mode of a profile
    You can configure an AK/SK, token, and agency in a profile. Run the following command to specify an authentication mode for a profile:
    hcloud configure set --cli-profile=test --cli-mode=token
  • 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=8NVT************KIOV --cli-secret-key=VHMQjoC**************************lsk3cGf
  • 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