All Products
Search
Document Center

Alibaba Cloud CLI:Command line options of Alibaba Cloud CLI

Last Updated:Jun 03, 2025

This topic describes the command-line options provided by Alibaba Cloud CLI. You can use the command-line options to change the default behaviors of commands or implement specific features of commands.

Syntax

You can append the options parameter to an API command in the following syntax:

aliyun <Command> <SubCommand> --options [optionParams]
  • Use space characters to separate an option and its parameters. If an option has a subfield, specify the field and its value in the format of subfield=value. For more information, see Parameter formats.

Available options

Option

Description

--profile,-p

You can use the --profile or -p option to specify a configuration profile. After you specify a valid configuration profile, Alibaba Cloud CLI ignores the default identity credential and environment variable configurations and uses the configurations that you specify to run commands.

Example: Call the DescribeInstances operation of Elastic Compute Service (ECS) with the akProfile configuration profile.

aliyun ecs DescribeInstances --profile akProfile

--region

You can use the --region option to specify a region. After you specify a valid region, Alibaba Cloud CLI ignores the region in the default identity credential and environment variable configurations and uses the region that you specify to run commands.

Example: Call the DescribeInstances operation of ECS with the cn-beijing region.

aliyun ecs DescribeInstances --region cn-beijing

--endpoint

You can use the --endpoint option to specify an endpoint. For information about the endpoints supported by an Alibaba Cloud service, see the Endpoints topic in the Developer Reference > API Reference section in the documentation of the service.

Example: Call the DescribeMonitorGroups operation of CloudMonitor with the metrics.cn-qingdao.aliyuncs.com endpoint.

aliyun cms DescribeMonitorGroups --endpoint metrics.cn-qingdao.aliyuncs.com

--version

You can use the --version option to specify an API version. This option must be used together with the --force option. For more information, see Forcibly call an API operation.

Example: Call the DescribeMetricList operation of CloudMonitor with the 2017-03-01 API version.

aliyun cms QueryMetricList \
  --Project acs_ecs_dashboard \
  --Metric cpu_idle \
  --version 2017-03-01 \
  --force

--header

You can use the --header option to add a request header. You can repeatedly use the option to add multiple request headers.

Example: Add the X-foo=bar request header to a command.

aliyun <product> <ApiName> --header X-foo=bar

--body

You can use the --body option to add a string as the request body when you call a resource-oriented architecture (ROA) API operation.

Example: Call the RunClusterCheck operation of Container Service for Kubernetes (ACK) with a JSON string specified as the request body.

aliyun cs POST /clusters/{cluster_id}/checks --body "{\"type\":\"NodePoolUpgrade\",\"target\":\"np1f6779297c4444a3a1cdd29be8e5****\"}"

--body-file

You can use the --body-file option to add a file as the request body when you call a remote procedure call (RPC) API operation. This option takes precedence over the --body option.

Example: Call the RunClusterCheck operation of Container Service for Kubernetes (ACK) with a file as the request body.

aliyun cs POST /clusters/{cluster_id}/checks --body-file /usr/local/bin/example.json

Sample code of the JSON file

{
    "type": "NodePoolUpgrade",
    "target": "np1f6779297c4444a3a1cdd29be8e5****"
}

--read-timeout

You can use the --read-timeout option to specify the I/O timeout period in seconds. After you specify a valid I/O timeout period, Alibaba Cloud CLI ignores the I/O timeout period in the default identity credential configurations and uses the I/O timeout period that you specify to run commands.

Example: Specify the I/O timeout period as 20 seconds.

aliyun <product> <ApiName> --read-timeout 20

--connect-timeout

You can use the --connect-timeout option to specify the connection timeout period in seconds. After you specify a valid connection timeout period, Alibaba Cloud CLI ignores the connection timeout period in the default identity credential configurations and uses the connection timeout period that you specify to run commands.

Example: Specify the connection timeout period as 20 seconds.

aliyun <product> <ApiName> --connect-timeout 20

--retry-count

You can use the --retry-count option to specify the allowed number of retries. After you specify a valid number, Alibaba Cloud CLI ignores the relevant retry configuration in the default identity credential configurations and uses the number of retries that you specify to run commands.

Example: Specify the allowed number of retries as 5.

aliyun <product> <ApiName> --retry-count 5

--secure

You can use the --secure option to enable the HTTPS mode. However, if the API operation does not support HTTPS, the request fails.

Note

By default, Alibaba Cloud CLI calls API operations over HTTPS.

--insecure

You can use the --insecure option to enable the HTTP mode. However, if the API operation does not support HTTP, the request fails.

--quiet,-q

You can use the --quiet option to disable the output of return results.

--help

You can use the --help option to obtain the help information about a command.

For more information, see Use the help command.

--output,-o

You can use the --output option to specify the fields to return in the form of a table.

For more information, see Extract parameters and tabulate output.

--pager

You can use the --pager option to specify to return aggregated results of a paging API operation.

For more information, see Aggregate the results of paging operations.

--force

You can use the --force option to specify to forcibly call API operations and use parameters that are not in the metadata list.

For more information, see Forcibly call an API operation.

--waiter

You can use the --waiter option to specify to poll return results and return data when a field changes to a specific value.

For more information, see Poll the return results.

--dryrun

You can use the --dryrun option to specify to simulate a call to the server and return the simulation results without performing actual operations on cloud resources.

For more information, see Simulate a call.