Before you use Alibaba Cloud CLI, you must run the aliyun configure
command to specify the AccessKey pair, region, and language that you want to use to call Alibaba Cloud resources.
You can create and view your AccessKey pair on the AccessKey Pair page in the Alibaba Cloud Management Console. You can also contact your system administrator to obtain the AccessKey pair.
$ aliyun configure
Configuring profile 'default' ...
Aliyun Access Key ID [None]: <Your AccessKey ID>
Aliyun Access Key Secret [None]: <Your AccessKey Secret>
Default Region Id [None]: cn-hangzhou
Default output format [json]: json
Default Language [zh]: zh
Configure multiple users
Alibaba Cloud CLI allows you to configure multiple users. You can run the $ aliyun configure --profile user1
command to specify the account that you want to use to call the API operations of cloud services.
You can run the $ aliyun configure list
command to view the current user configurations. The following table shows an example on user configurations. The user whose profile name contains an asterisk (*) as a suffix is the default user.
Profile | Credential | Valid | Region | Language
--------- | ------------------ | ------- | ---------------- | --------
default * | AK:***f9b | Valid | cn-beijing | zh
aaa | AK:****** | Invalid | |
test | AK:***456 | Valid | | en
ecs | EcsRamRole:EcsTest | Valid | cn-beijing | en
Authentication methods
You can append the --mode <authenticationMethod>
parameter to the configure
command in the Alibaba Cloud CLI to specify an authentication method. The following table shows the authentication methods supported by Alibaba Cloud CLI.
Authentication method | Description |
AK | Use an AccessKey pair for authentication. |
StsToken | Use an STS token for authentication. |
RamRoleArn | Use AssumeRole of a RAM user for authentication. |
EcsRamRole | Use EcsRamRole of an ECS instance for password-free authentication. |