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

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).
      cloud configure set --cli-profile=testAKSK --cli-mode=AKSK --cli-region=ru-moscow-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).
      cloud configure set --cli-profile=testAKSKST --cli-mode=AKSK --cli-region=ru-moscow-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).
      cloud configure set --cli-profile=testToken --cli-mode=token --cli-region=ru-moscow-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.
      cloud configure set --cli-profile=testEcsAgency --cli-mode=ecsAgency --cli-region=ru-moscow-1 --cli-read-timeout=10 --cli-connect-timeout=5

      When you use Cloud CLI 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.
        cloud configure set --cli-profile=testAKSK --cli-mode=AKSK --cli-region=ru-moscow-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.
        cloud configure set --cli-profile=testAgency --cli-mode=agency --cli-region=ru-moscow-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:

    cloud configure set --cli-profile=test

  • Changing the language

    This change will take effect for all profiles. Run the following command to change the language:

    cloud 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 offline mode:

    cloud configure set --cli-offline=true
  • 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:

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

    This change will take effect for all profiles. When using Cloud CLI 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:

    cloud configure set --cli-agree-privacy-statement=true
  • 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:

    cloud configure set --cli-profile=test --cli-mode=AKSK

  • Changing the region of a profile
    cloud configure set --cli-profile=test --cli-region=ru-moscow-1
  • Modifying the AK/SK of a profile

    AK and SK must be modified at the same time.

    cloud 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.

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

    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
    cloud configure set --cli-profile=test --cli-skip-secure-verify=true
Note

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:

cloud configure set --cli-profile=test --cli-project-id=0681194*******************f89d2e --cli-region=ru-moscow-1