Understanding Alibaba Cloud CLI command structure

Updated at:
Copy as MD

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

  1. Alibaba Cloud CLI is installed. For more information, see Install, update, and uninstall Alibaba Cloud CLI.

  2. 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:

  • command is the top-level command, such as a product code like ecs or a management command like configure.

    • Management commands. For example:

      • configure (configure credentials and default parameters).

      • plugin (manage plugins).

      • upgrade (upgrade the CLI main program).

      Run aliyun --help-all to view the complete list of top-level commands.

    • Product codes. For example, ecs, rds, cs, and fc.

  • sub-command specifies an operation and is not limited to an API name.

    • When the top-level command is a management command, run aliyun <command> --help to view the available parameters or sub-commands.

    • For example, use DescribeInstances to specify a cloud product operation.

  • parameters are 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-hangzhou and --profile prod.

Minimal example

The following command queries the list of regions accessible to the current account and requires no additional parameters:

aliyun ecs DescribeRegions

Using 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-all

List all sub-commands

aliyun ecs --help-all

View 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 --help

View 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-all

Machine-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 json
Note

In 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]

Required parameter

Type annotation

Parameter data type, such as String, Integer, Boolean, Array, or JSON

Default value

For example, --output json (default is json)

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.