[English](./README.md) | [简体中文](./README-CN.md)
A cross-platform command-line tool for managing Alibaba Cloud resources through OpenAPI.
Alibaba Cloud CLI (`aliyun`) is written in Go and works on macOS, Linux, and Windows. It supports interactive and non-interactive credential profiles, OpenAPI calls, local API help, structured output, waiters, safety controls, and an extensible plugin system. > Alibaba Cloud CLI invokes cloud services through OpenAPI. Activate the target service first and make sure your identity has the required permissions. Avoid long-lived AccessKeys where a temporary or identity-based credential mode is available. ## Install Choose one of the following methods: ```sh # Homebrew brew install aliyun-cli # macOS or Linux installer script /bin/bash -c "$(curl -fsSL https://aliyuncli.alicdn.com/install.sh)" ``` Official packages: - [macOS GUI installer](https://aliyuncli.alicdn.com/aliyun-cli-latest.pkg) - [macOS universal archive](https://aliyuncli.alicdn.com/aliyun-cli-macosx-latest-universal.tgz) - [Linux AMD64](https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz) - [Linux ARM64](https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-arm64.tgz) - [Windows x64](https://aliyuncli.alicdn.com/aliyun-cli-windows-latest-amd64.zip) - [All GitHub releases](https://github.com/aliyun/aliyun-cli/releases) Verify the installation: ```sh aliyun version ``` Upgrade an existing standalone installation: ```sh aliyun upgrade ``` If the CLI was installed through a package manager, prefer that package manager's upgrade command. See the [installation guide](./docs/en/installation.md) for PATH setup, source builds, and upgrades. To try the CLI without installing it locally, open [Alibaba Cloud Shell](https://shell.aliyun.com/):
## Quick start
### 1. Configure a profile
For an interactive local environment, OAuth avoids storing a long-lived AccessKey:
```sh
aliyun configure --mode OAuth --profile default
```
For a remote machine without a browser, use:
```shell
aliyun configure --mode OAuth --profile default --no-browser
```
Open the printed authorization link on a device with a browser. After signing in,
copy the complete callback URL from the address bar and paste it into the CLI,
even if the browser reports a connection error. Include both `code` and `state`.
This mode does not start a local callback server or require port forwarding.
Press Ctrl+C to cancel.
You can also use AK, StsToken, RamRoleArn, EcsRamRole, OIDC, External, CredentialsURI, ChainableRamRoleArn, CloudSSO, BearerToken, or Anonymous mode where applicable.
```sh
# Inspect and select profiles
aliyun configure list
aliyun configure switch --profile default
```
See [configuration and credentials](./docs/en/configuration.md) before using a profile in production or CI.
### 2. Call an API
Both the traditional PascalCase form and the metadata-driven kebab-case form are supported where metadata is available:
```sh
aliyun ecs DescribeRegions
aliyun ecs describe-regions
```
Safety policy matches command names case-insensitively, without expanding API aliases. Configure a rule for each command name used by your automation. See [command matching rules](./docs/en/usage.md#command-matching-rules).
### 3. Explore help
```sh
aliyun --help
aliyun ecs DescribeInstances --help
aliyun ecs describe-instances --help
```
## Common capabilities
### Filter and format output
```sh
aliyun ecs DescribeInstances \
--output cols=InstanceId,Status rows=Instances.Instance[]
aliyun ecs describe-instances \
--cli-query 'Instances.Instance[].{Id:InstanceId,Status:Status}'
```
### Wait for a resource state
```sh
aliyun ecs DescribeInstances \
--InstanceIds '["i-example"]' \
--waiter expr='Instances.Instance[0].Status' to=Running
```
### Use product plugins
```sh
aliyun plugin search