If you follow the interactive process to configure credentials, you do not need to specify the options for the credential. You only need to enter the corresponding values when prompted. This configuration method verifies the validity of the credential. Regardless of whether the credential is valid or not, it is written into the configuration file.

Overview

Interactive configuration uses the configure command to configure credentials. The command format is as follows:
aliyun configure --mode <AuthenticateMode> --profile <profileName>
The description of the configuration options is as follows:
  • --profile: Specify the configuration name. If the specified configuration exists, modify the configuration. If it does not exist, you must create a configuration.
  • --mode: Specify the credential type. They are AK, StsToken, RamRoleArn, and EcsRamRole.
The prompt information of this configuration mode includes the AccessKey and RegionId:
  • Make sure that you enter the correct AccessKey information. If it is incorrect, the interface cannot be called.
    Note You can create and view your AccessKey on the AccessKey page of the Alibaba Cloud console, or obtain the AccessKey from your system administrator.
  • For a complete list of regions supported by Alibaba Cloud, see Regions and zones.
After the configuration is completed, if the configuration credential is valid, the following information is displayed:
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 ..............

Configure AccessKey credential

In the Alibaba Cloud CLI, the AccessKey credential type is named AK. It is the default credential type. Therefore, when using this method to quickly configure credential, you can ignore --mode option.

The following command configures an AccessKey credential named akProfile:
aliyun configure --profile akProfile
Configuring profile 'akProfile' in '' authenticate mode...
Access Key Id []: AccessKey ID
Access Key Secret []: AccessKey Secret
Default Region Id []: cn-hangzhou
Default Output Format [json]: json (Only support json)
Default Language [zh|en] en:
Saving profile[akProfile] ...Done.

Configure STS token credential

If you access Alibaba Cloud by using the StsToken credential type, you must specify --mode StsToken.

The following command configures an STS Token credential named stsTokenProfile:
aliyun configure --profile stsTokenProfile --mode StsToken
Configuring profile 'stsTokenProfile' in 'StsToken' authenticate mode...
Access Key Id []: AccessKey ID
Access Key Secret []: AccessKey Secret
Sts Token []: StsToken
Default Region Id []: cn-hangzhou
Default Output Format [json]: json (Only support json)
Default Language [zh|en] en:
Saving profile[stsTokenProfile] ...Done.

Configure RamRoleArn credential

If you access Alibaba Cloud by using the RamRoleArn credential type, you must specify --mode RamRoleArn.

The following command configures an RamRoleArn credential named ramRoleArnProfile:
aliyun configure --profile ramRoleArnProfile --mode RamRoleArn
Configuring profile 'ramRoleArnProfile' in 'RamRoleArn' authenticate mode...
Access Key Id []: AccessKey ID
Access Key Secret []: AccessKey Secret
Ram Role Arn []: RamRoleArn
Role Session Name []: RoleSessionName
Default Region Id []: cn-hangzhou
Default Output Format [json]: json (Only support json)
Default Language [zh|en] en:
Saving profile[ramRoleArnProfile] ...Done.

Configure EcsRamRole credential

If you access Alibaba Cloud by using the EcsRamRole credential type, you must specify --mode EcsRamRole.

The following command configures an EcsRamRole credential named ecsRamRoleProfile:
aliyun configure --profile ecsRamRoleProfile --mode EcsRamRole
Configuring profile 'ecsRamRoleProfile' in 'EcsRamRole' authenticate mode...
Ecs Ram Role []: EcsRamRole
Default Region Id []: cn-hangzhou
Default Output Format [json]: json (Only support json)
Default Language [zh|en] en:
Saving profile[ecsRamRoleProfile] ...Done.
Note This credential type is used for ECS instances. You do not need to configure the AK information. You only need to configure roles. For more information on the EcsRamRole credential type, see the Instance RAM role overview.