All Products
Search
Document Center

Alibaba Cloud CLI:Understand Alibaba Cloud CLI command parameters

Last Updated:Jun 05, 2026

Alibaba Cloud CLI command parameters are classified into global flags that control CLI behavior and business parameters that are passed to subcommands. This topic describes how to view available parameters, format parameter values of various data types, and use the auto-completion feature.

Prerequisites

Parameter types

A CLI command consists of a command, a subcommand, and parameters:

aliyun <command> <sub-command> [parameters]

Parameters are classified into two types:

  • Global flags: Control the behavior of the CLI itself, such as region selection, output format, and pagination. Global flags apply to all commands.

  • Business parameters: Request fields that are passed to subcommands. Business parameters vary by operation.

In the following example, --help is a global flag and --biz-region-id is a business parameter:

aliyun ecs describe-instances --help
aliyun ecs describe-instances --biz-region-id cn-hangzhou

Global flags

The following flags apply to all plugin commands, including specifying a region, paginating query results, and enabling dry-run mode:

Flag

Type

Description

--region

string

Specifies the region ID, such as cn-hangzhou. This flag overrides the default region in the configuration.

--endpoint

string

Specifies the API endpoint URL. In most cases, you do not need to manually set this flag.

--cli-query

string

Filters output by using a JMESPath expression.

--pager / --all-pages

list

Automatically aggregates all paginated API results. --all-pages is an alias of --pager.

--cli-dry-run

bool

Dry-run mode: validates parameters and prints the request content without actually sending the request. For plugin commands, use this flag instead of the legacy --dryrun flag.

--cli-ai-mode

bool

AI-assisted mode. When enabled, an AI identifier is added to the User-Agent header of the current API request.

--log-level

string

Sets the log output level for debugging and troubleshooting. Valid values: DEBUG / INFO / WARN / ERROR

-q / --quiet

bool

Quiet mode: suppresses the API response output. This flag is suitable for scripting and CI/CD scenarios.

-h / --help

bool

Displays help information.

Note

--cli-dry-run is mutually exclusive with --pager and --quiet. These flags cannot be used together because dry-run mode does not send actual requests.

Business parameters

Business parameters are request fields that are passed to subcommands. Different operations have different business parameters.

aliyun ecs describe-instances --biz-region-id cn-hangzhou --cli-dry-run

The data types of business parameters are defined by APIs. Common types include:

  • String: A text string, such as an instance ID or name.

  • Integer: A whole number, such as a page number or count.

  • Boolean: A Boolean value of true or false.

  • Array / JSON: An array or JSON object, such as a list of disk IDs or a tag object.

How to obtain parameters for built-in commands

Built-in commands are integrated into the Alibaba Cloud CLI core program and can be used directly without installing additional plugins.

Use cases

  • CLI management: Perform operations related to the CLI runtime environment, such as configuring credentials, managing plugins, and viewing help information.

  • Core integrated tools: Run cloud service tool commands that are embedded in the CLI core, such as ossutil and otsutil.

  • Legacy command compatibility: Use legacy CLI commands when the corresponding plugin is not installed, or when the Alibaba Cloud CLI version is earlier than 3.3.0.

Common operations

  • View all built-in commands: Run aliyun --help and check the Commands section in the output for the complete list.

  • View command parameters: Run aliyun <command> --help (for example, aliyun configure --help). The help output is the only authoritative reference for verifying parameter availability.

Discover parameters

You can view the parameters that a command supports by using CLI help information or the online OpenAPI portal.

Use CLI help information

Append --help to a command to view all supported parameters and their descriptions. The format of help output varies by command type.

Built-in commands

Built-in commands are integrated into the Alibaba Cloud CLI core program and can be used directly without installing additional plugins, such as configure. The help output for built-in commands displays subcommands or specific options:

aliyun configure --help

Help output:

configure credential and settings

Usage:
  aliyun configure --mode {AK|RamRoleArn|EcsRamRole|OIDC|External|CredentialsURI|ChainableRamRoleArn|CloudSSO|OAuth} --profile <profileName> [--config-path <configPath>]

Commands:
  get             print configuration values
  set             set config in non interactive mode
  list            list all config profile
  delete          delete the specified profile
  switch          switch default profile
  safety-policy   manage safety policy and human-in-the-loop rules
  ai-mode         manage global AI mode and User-Agent for API calls
  plugin-settings manage global plugin system settings

Plugin commands

The help output for cloud service plugin commands displays parameter names in kebab-case format, including parameter types and default values:

aliyun ecs describe-instances --help

Help output:

Description: Queries a list of instances and their details based on specified conditions

API Version: 2014-05-26

Usage:
  aliyun ecs describe-instances [parameters]

Parameters:
  --biz-region-id                string (required), The ID of the region where the
                                 instance resides. You can call https://help.aliyun.
                                 com/document_detail/25609.html to query the latest
                                 list of Alibaba Cloud regions
  --additional-attributes        list, The list of other instance attributes
                                 format: --additional-attributes value1 value2 value3
  --device-available             bool, > This parameter is in invitational preview
                                 and is not available for use
......

Global Flags:
  --cli-ai-mode             bool, For this run, enable AI-mode
  --cli-dry-run             bool, Enable dry-run mode: print request details
                            without sending the actual API call
  --cli-query               string, Use `--cli-query <jmespath>` to filter
                            output with JMESPath expression
  --endpoint                string, Override service endpoint (e.g., --endpoint
                            https://ecs.cn-hangzhou.aliyuncs.com)
......

Examples:
  aliyun ecs describe-instances --biz-region-id example-value
  aliyun ecs describe-instances --biz-region-id example-value --vpc-id example-value

Legacy CLI commands (OpenAPI style)

The help output for legacy CLI commands displays parameter names in PascalCase format. The parameter information is retrieved from API metadata:

aliyun ecs DescribeInstances --help

Help output:

Product: Ecs (Elastic Compute Service)

Parameters:
  --RegionId String  Required

  The region ID of the instance. You can call the [DescribeRegions](~~25609~~) operation to query the most recent region list.

  --AdditionalAttributes.n RepeatList Optional

  The additional instance attributes.
......

Use the OpenAPI portal

The Alibaba Cloud OpenAPI portal allows you to debug APIs online and automatically generates CLI command examples. For more information, see Generate and run CLI commands with OpenAPI Explorer.

Parameter values

The way you pass parameter values varies by data type and operating system environment.

Common type parameter values

Data type

Format

Example

Integer

Pass the value directly without quotes.

--page-size 10

String

Pass the value directly if it does not contain special characters. Enclose the value in quotes if it contains special characters.

--instance-id i-bp1234****

Boolean

A flag that enables or disables a feature. For example, including --dry-run enables the feature, and omitting it disables the feature.

--dry-run

String list

Separate multiple values with commas and enclose the entire list in quotes.

--image-id 'm-bp1****,m-bp2****'

JSON array

A JSON-formatted string enclosed in quotes.

--disk-ids '["d-bp1****","d-bp2****"]'

Date

ISO 8601 format: YYYY-MM-DDThh:mm:ssZ

--start-time 2024-11-28T15:00:00Z

Different operating systems and terminal environments handle quotes differently. When passing parameter values that contain special characters, use the following quoting rules:

Environment

General quotes

Quotes for the --body flag

Linux / macOS

Single quotes ''

Double quotes ""

Windows Command Prompt

Double quotes ""

Double quotes ""

Windows PowerShell

Single quotes ''

Single quotes ''

JSON parameter values

Some command parameters require values in JSON format. The choice of outer quotes and inner quotes varies by operating system.

JSON arrays

  • Linux / macOS: Use single quotes for the outer layer and double quotes for inner values.

    aliyun ecs describe-disks --disk-ids '["d-bp1****","d-bp2****","d-bp3****"]' --biz-region-id cn-hangzhou
  • Windows (Command Prompt and PowerShell): Use double quotes for the outer layer and single quotes for inner values.

    aliyun ecs describe-disks --disk-ids "['d-bp1****','d-bp2****','d-bp3****']" --biz-region-id cn-hangzhou

JSON objects

When a parameter value is a JSON object, enclose each JSON object in braces {} and separate keys and values with colons :.

  • Linux / macOS:

    aliyun slb add-backend-servers --load-balancer-id lb-bp1**** --backend-servers '[{"ServerId":"i-bp1****"},{"ServerId":"i-bp2****"}]'
  • Windows (Command Prompt and PowerShell):

    aliyun slb add-backend-servers --load-balancer-id lb-bp1**** --backend-servers "[{'ServerId':'i-bp1****'},{'ServerId':'i-bp2****'}]"

Values that contain special characters

Values that start with a hyphen (-)

When a parameter value starts with -, the CLI may misinterpret it as another parameter name:

aliyun ecs AuthorizeSecurityGroup --SecurityGroupId 'sg-bp67acfmxazb4p****' --Permissions.1.PortRange "-1/-1" --method POST --force

Use an equal sign to connect the parameter name and value to resolve this issue:

aliyun ecs AuthorizeSecurityGroup --SecurityGroupId 'sg-bp67acfmxazb4p****' --Permissions.1.PortRange=-1/-1 --method POST --force

Shell special characters

When parameter values contain shell special characters ($, `, \, spaces, and so on), you must enclose them in quotes. On Linux / macOS, use single quotes to prevent the shell from interpreting special characters. On Windows Command Prompt, use double quotes.

# Linux/macOS/PowerShell
aliyun ecs describe-images --image-name 'Example Image'
# Windows CMD
aliyun ecs describe-images --image-name "Example Image"

# Linux/macOS
aliyun xxx --param '$literal_dollar'

Load parameter values from a file

When a parameter value is long, such as a certificate or a large JSON payload, it is more convenient to load the value from a local file.

--body-file (RESTful API calls)

In RESTful API calls, use --body-file to load the HTTP request body from a local file.

aliyun cs PUT /clusters/c1234****/nodepools/np5678**** --body-file request.json

Shell command substitution and here-doc

You can also use shell command substitution ($(cat ...)) or a here-doc to pass file content to the --body parameter:

# Command substitution
aliyun cs PUT /clusters/c1234****/nodepools/np5678**** --body "$(cat request.json)"

# Here-doc (suitable for constructing inline JSON in scripts)
aliyun cs PUT /clusters/c1234****/nodepools/np5678**** --body "$(cat <<EOF
{
  "nodepool_info": {
    "name": "default-nodepool",
    "resource_group_id": "rg-acfmyvw****"
  }
}
EOF
)"
Note

Shell command substitution and here-doc are only applicable to bash or zsh environments. For Windows environments, use --body-file.

Command auto-completion

Alibaba Cloud CLI supports command auto-completion. After you enable this feature, you can press Tab to auto-complete product names, operation names, and parameter names.

Note

Auto-completion is only supported in bash or zsh environments on Linux and macOS systems. Auto-completion covers product names, operation names, and parameter names, but does not cover parameter values.

Run the following command to enable auto-completion:

aliyun auto-completion

After you enable auto-completion, run the following command to apply the configuration immediately, or restart the terminal:

# bash
source ~/.bash_profile

# zsh
source ~/.zshrc

To verify that auto-completion is working, type aliyun and press Tab. If a list of candidate commands appears (such as configure), auto-completion is enabled.

To disable auto-completion, run:

aliyun auto-completion --uninstall

FAQs

--help shows a parameter as Optional. Can I always omit it?

Not necessarily. Some commands have mutually exclusive parameters, meaning you must specify one or the other. Such parameters are individually marked as optional, but at least one of them must be specified. Otherwise, an error is returned. For specific requirement rules, refer to the API documentation of the relevant product.