edit-icon download-icon

Multi-account use

Last Updated: Oct 08, 2016

Notices: This feature is useful for users who need to manage many accoutns and many devices. If you only need to manage an accout, ignore this feature.

Alibaba Cloud CLI supports multi-account systems. You can configure multiple access keys and secret values, region and output as needed, to meet your different requirements more flexibly. For the information about how to configure accouts in Alibaba Cloud CLI, refer to Configuration of Alibaba Cloud CLI (for Alibaba Cloud users).

Basic command structure

The basic command structure of multi-accout management is shown as follows:

  1. aliyuncli configure [set/get/list] --profile profilename --key value --key1 value1
  • configure: Manage configurations.

  • set: Set a configuration value. Optional.

  • get: Display a configuration value. Optional.

  • list: List all values of a profile. Optional.

  • profile: Profile used in the current operation, which is a global parameter. For details, refer to the description of profile in Global parameter description. If this option is not included, a default account is used.

  • key: Specific key for configuring a profile.

  • Value: Value being configured, which is behind key.

Accout type

There are two kinds of accounts in the config file: [default] account and [profile profilename] account. In Alibaba Cloud CLI, if the option profile is not included, the [default] account is used; if the option profile profilename is included, [profile profilename] is used.

The following shows the examples of profile:

  1. aliyuncli configure Configure [default] account quickly
  1. aliyuncli configure --profile test Configure [profile test] account quickly

The following shows the examples of set:

  1. aliyuncli configure set --output table --region cn-qingdao Set [default] account, output=table, region=cn-qingdao
  1. aliyuncli configure set --output json --region cn-hangzhou --profile test1 Set [profile test1] account, output = json, region = cn-hangzhou

The following shows the examples of get:

  1. aliyuncli configure get region Get the region of [default] account

Output: region = cn-hangzhou

  1. aliyuncli configure get output region Get the output and region values of [default] account

Output:

output = json

region = cn-hangzhou

  1. aliyuncli configure get region --profile profile1 Get the region under [profile profile1] account

The following shows the examples of list:

  1. aliyuncli configure list List information under [default] account
  1. aliyuncli configure list --profile profile1 List information under [profile profile1] account

The output is as follows:

multiaccout-list

Thank you! We've received your feedback.