Understanding Alibaba Cloud CLI command structure
Alibaba Cloud CLI uses a unified 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 is installed. For more information, see Install, update, and uninstall Alibaba Cloud CLI.
Credentials are configured for Alibaba Cloud CLI. For more information, see Configure and manage credentials.
Command format
General command format
The general command structure for Alibaba Cloud CLI is as follows:
aliyun <command> <sub-command> [parameters]Description of each component:
commandis the top-level command, such as a product code likeecsor a management command likeconfigure.Management commands. For example:
configure(configure credentials and default parameters).plugin(manage plugins).upgrade(upgrade the CLI main program).
Run
aliyun --help-allto view the complete list of top-level commands.Product codes. For example,
ecs,rds,cs, andfc.
sub-commandspecifies an operation and is not limited to an API name.When the top-level command is a management command, run
aliyun <command> --helpto view the available parameters or sub-commands.For example, use
DescribeInstancesto specify a cloud product operation.
parametersare command parameters that specify business input or control CLI behavior. For more information about parameter formats, see Understand command parameters.Business parameters: Prefixed with
--. For example,--InstanceId 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 DescribeRegionsUsing command help
Alibaba Cloud CLI provides three levels of --help drill-down. By appending --help after a top-level command (such as ecs) or a sub-command, you can view the available sub-command list and parameter details. Help output in an Agent environment may be truncated. To retrieve the complete list of commands and parameters, use --help-all.
List management commands and supported cloud products
aliyun --help-allList all sub-commands
aliyun ecs --help-allView parameter details
Displays the parameter list, whether each parameter is required, data type, default value, and examples for the specified sub-command:
aliyun ecs DescribeInstances --helpView the full help for the current level
Append --help-all to a command to display the complete help documentation for the current command level, including all sub-commands, parameters, and endpoints:
aliyun ecs --help-allSearch help
Append --help-search <keyword> to a command to search for matching commands and parameters by keyword at the current command level:
aliyun --help-search configureMachine-readable help
Append --cli-output json to output help information in JSON format, which is convenient for script parsing and AI Agent calls:
aliyun --help --cli-output jsonIn a supported AI Agent environment, the CLI automatically detects the environment and outputs help information in JSON format by default. To disable this behavior, set the environment variable ALIBABA_CLOUD_CLI_AGENT_INTEGRATION=disabled. For more information about AI mode, see AI Mode.
Key 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"
Check the spelling of the top-level command and sub-command. Use command help to find available commands and parameters. Use --help-all when you need a complete list, and check the CLI version.
How to view the parameters supported by a sub-command
Run aliyun <command> <sub-command> --help to view the full parameter list.