Before you use Cloud Assistant CLI, you must configure your credentials, region, and language. This information is required to make calls to Alibaba Cloud resources.
Ensure that your credential information is accurate during configuration. This helps prevent unnecessary losses from misoperations or failed API calls.
Identity credential configuration methods
Cloud Assistant CLI provides two configuration methods: interactive and non-interactive. The interactive method offers a guided process that helps you quickly configure identity credentials in Cloud Assistant CLI with a low learning curve.
Interactive configuration
General syntax
To configure credentials interactively, you can invoke the aliyun <a baseurl="t395345_v3_0_0.xdita" data-node="395350" data-root="7086" data-tag="xref" href="t395350.xdita#088c4c1fc8x3u" id="a5b02a6e850pt">configure</a>
command. The command syntax is as follows:
aliyun configure [--profile <PROFILE_NAME>] [--mode <AUTHENTICATE_MODE>]
Parameters:
PROFILE_NAME
: The name of the configuration.If the specified configuration exists, it is modified. If it does not exist, a new configuration is created.
If you do not specify this option, the current configuration is modified. For more information, see Credential management.
AUTHENTICATE_MODE
: The type of identity credential. The default is the AK type.
The following is a sample response for a successful configuration:
Configure Done!!! ..............888888888888888888888 ........=8888888888888888888D=.............. ...........88888888888888888888888 ..........D8888888888888888888888I........... .........,8888888888888ZI: ...........................=Z88D8888888888D.......... .........+88888888 ..........................................88888888D.......... .........+88888888 .......Welcome to use Alibaba Cloud.......O8888888D.......... .........+88888888 ............. ************* ..............O8888888D.......... .........+88888888 .... Command Line Interface(Reloaded) ....O8888888D.......... .........+88888888...........................................88888888D.......... ..........D888888888888DO+. ..........................?ND888888888888D.......... ...........O8888888888888888888888...........D8888888888888888888888=........... ............ .:D8888888888888888888.........78888888888888888888O ..............
Non-interactive configuration
General syntax
You can use the <a baseurl="t395345_v3_0_0.xdita" data-node="395350" data-root="7086" data-tag="xref" href="t395350.xdita#289ac5b8e2cvk" id="14941ad19583u">aliyun configure set</a>
command to configure credentials in non-interactive mode. Syntax:
aliyun configure set [--profile <PROFILE_NAME>] [--mode <AUTHENTICATE_MODE>] [--settingName <SETTING_VALUE>...]
Options:
PROFILE_NAME
: Specifies the name of the configuration. If a configuration with the specified name exists, it is modified. Otherwise, a new configuration is created.AUTHENTICATE_MODE
: Specifies the credential type for the configuration. The AccessKey (AK) type is used by default. For more information about the supported types, see Identity credential types.SETTING_VALUE
: The required information varies depending on the credential type. For more information, see Identity credential types and Create or modify a configuration in non-interactive mode.
After you configure credentials in non-interactive mode, you can use the <a baseurl="t395345_v3_0_0.xdita" data-node="395350" data-root="7086" data-tag="xref" href="t395350.xdita#4addcad7ec44w" id="66c35caaa0oap">aliyun configure list</a>
or <a baseurl="t395345_v3_0_0.xdita" data-node="395350" data-root="7086" data-tag="xref" href="t395350.xdita#13d374aa41q2t" id="1bd85226b351e">aliyun configure get</a>
command to verify that the configuration was created successfully.
Identity credential types
Cloud Assistant CLI provides the following credential types. You can configure them as needed.
Credential type | Credential refresh policy | Key-free access |
Manual refresh | Not supported | |
Manual refresh | Not supported | |
Auto-refresh | Not supported | |
Auto-refresh | Supported | |
Refreshed by an external system | Supported | |
Follows the refresh policy of the preceding credential | Supported | |
Refreshed by an external system | Supported | |
Auto-refresh | Supported | |
Requires browser logon | Supported | |
Requires browser interaction for initial authorization. Can be auto-refreshed later. | Supported |
Credential management
Cloud Assistant CLI lets you configure and manage multiple identity credentials. You can switch between or specify credential configurations as needed.
Set the current configuration
Run the following command to set a specified configuration as the current configuration:
aliyun configure switch --profile <PROFILE_NAME>
After the switch is successful, Cloud Assistant CLI uses the settings and credentials in this configuration by default until you make another change.
In addition, when the <a baseurl="t395345_v3_2_0.xdita" data-node="395350" data-root="39083" data-tag="xref" href="t395350.xdita#289ac5b8e2cvk" id="d7e8857d3e65g">aliyun configure set</a>
command runs successfully, the modified configuration automatically becomes the current configuration.
Specify a configuration in the command line
When you run a command in the command-line interface (CLI), you can use the --profile
option to explicitly specify the configuration to use. This option has the highest priority and overwrites any other default configuration.
Example: Use the specified configuration exampleProfile
to call the Elastic Compute Service DescribeInstances
operation and retrieve Elastic Compute Service instance information.
aliyun ecs DescribeInstances --profile exampleProfile
More credential management commands
The Cloud Assistant CLI provides the configure
command and its subcommands to manage multiple identity credentials. You can use these commands to add, delete, modify, and view credentials. For more information, see Manage multiple credentials.
Credential configuration storage location
A credential profile, also known as a profile
, is a named set of settings. All credential information and settings are stored in the config.json
file in JSON format. This file is located in the .aliyun
folder in your home directory. The location of the home directory depends on the operating system.
Windows:
C:\Users\<USER_NAME>\.aliyun
Linux/macOS:
/home/<USER_NAME>/.aliyun