Understanding Alibaba Cloud CLI command structure
Alibaba Cloud CLI uses a unified plugin-based command structure. This topic describes the components of a command and how to use --help to quickly view available commands and parameters.
Prerequisites
Alibaba Cloud CLI 3.3.0 or later is installed. For more information, see Install, update, and uninstall Alibaba Cloud CLI.
A credential is configured for Alibaba Cloud CLI. For more information, see Configure and manage credentials.
Command format
Plugin-based CLI command format
The general command structure for the plugin-based Alibaba Cloud CLI is as follows:
aliyun <command> <sub-command> [parameters]Description of each component:
command: The top-level command, which can be one of the following two types:Built-in commands (no plugin installation required). For example:
configure(configure credentials and default parameters).plugin(manage plugins).upgrade(upgrade the CLI).
Run
aliyun --helpto view all built-in commands.Cloud product plugin names. For example,
aliyun-cli-ecs,aliyun-cli-oss,aliyun-cli-cs, andaliyun-cli-fc.
sub-command: The sub-command (SubCommand) that specifies the operation to perform.When the top-level command is a built-in command, run
aliyun <command> --helpto view the available parameters or sub-commands.When the top-level command is a cloud product plugin, sub-commands use kebab-case naming. For example,
describe-instancesandcreate-bucket.
parameters: Command parameters that control the behavior of Alibaba Cloud CLI or specify API parameters. For more information about parameter formats, see Understand command parameters.Business parameters: Prefixed with
--. For example,--instance-id i-xxx.Global parameters: Common parameters that affect the overall command behavior. For example,
--region cn-hangzhouand--profile prod.
Minimal example
The following command queries the list of regions accessible to the current account and requires no additional parameters:
aliyun ecs describe-regionsOn-demand plugin loading
CLI plugins are independently distributed cloud product command sets that support automatic on-demand installation:
List installed plugins:
aliyun plugin listAuto-install on first run (default behavior for CLI ≥ 3.3.0):
# If the ecs plugin is not installed, the CLI downloads and caches it automatically. aliyun ecs describe-instancesManually install a specific plugin:
aliyun plugin install --names ecs
For more plugin management operations, see Manage and use Alibaba Cloud CLI plugins.
Legacy CLI command format (OpenAPI style)
Using command help
Alibaba Cloud CLI provides three levels of --help drill-down. Append --help after a plugin name (such as ecs) or a sub-command to view the available sub-command list and parameter details.
List built-in commands and supported plugins
aliyun --helpList all sub-commands
aliyun ecs --helpView parameter details
Displays the parameter list, whether each parameter is required, data type, default value, and examples for the specified sub-command:
aliyun ecs describe-instances --helpKey markers in help output
Marker | Description |
| Required parameter |
Type annotation | Parameter data type, such as String, Integer, Boolean, Array, or JSON |
Default value | For example, |
Example snippet | Usually located at the end of the help output, showing typical invocation patterns |
FAQs
Running a command returns "Command not found"
This error indicates that the corresponding cloud product plugin is not installed. CLI ≥ 3.3.0 supports auto-installation on first run. If auto-installation fails due to network restrictions, manually run the following command to install the plugin:
aliyun plugin install --names ecsHow to view the parameters supported by a sub-command
Run aliyun <command> <sub-command> --help to view the full parameter list.