mcpField
A
Alibaba Cloud CLI

Alibaba Cloud CLI

OfficialAgent-ready
alibabacloud.comCloud & DevOps1.1kaliyunUpdated 2d ago
RepositoryVisit website

About Alibaba Cloud CLI

Alibaba Cloud CLI is the official command-line tool for Alibaba Cloud, providing complete access to Alibaba Cloud OpenAPI. It supports multiple configuration profiles, SSO authentication, and request diagnostics for automation and scripting.

Key features

  1. 01Access all Alibaba Cloud services through OpenAPI (compute, storage, networking, etc.)
  2. 02Manage multiple accounts and credentials using configuration profiles
  3. 03Diagnose request failures and inspect API response details
  4. 04Structured output in JSON and table formats

Use cases

  1. 01Automate deployment and management of Alibaba Cloud infrastructure with coding agents
  2. 02Batch operations on ECS instances, OSS buckets, and other resources in scripts
  3. 03Integrate Alibaba Cloud service calls into CI/CD workflows

Install

Pick your OS or package manager and run the command in a terminal.

$
brew install aliyun-cli

Once installed, runaliyun --versionto confirm it works.

Example commands

Common commands in the order you’d use them.

01
aliyun configure
02
aliyun ecs DescribeInstances
03
aliyun oss ls

Details

From the project README

English | 简体中文

Alibaba Cloud CLI

A cross-platform command-line tool for managing Alibaba Cloud resources through OpenAPI.

Build status Latest release License

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:

# Homebrew
brew install aliyun-cli

# macOS or Linux installer script
/bin/bash -c "$(curl -fsSL https://aliyuncli.alicdn.com/install.sh)"

Official packages:

Verify the installation:

aliyun version

Upgrade an existing standalone installation:

aliyun upgrade

If the CLI was installed through a package manager, prefer that package manager's upgrade command.

See the installation guide for PATH setup, source builds, and upgrades.

To try the CLI without installing it locally, open Alibaba Cloud Shell:

Alibaba Cloud Shell

Quick start

1. Configure a profile

For an interactive local environment, OAuth avoids storing a long-lived AccessKey:

aliyun configure --mode OAuth --profile default

For a remote machine without a browser, use:

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.

# Inspect and select profiles
aliyun configure list
aliyun configure switch --profile default

See configuration and credentials 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:

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.

3. Explore help
aliyun --help
aliyun ecs DescribeInstances --help
aliyun ecs describe-instances --help

Common capabilities

Filter and format output
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
aliyun ecs DescribeInstances \
  --InstanceIds '["i-example"]' \
  --waiter expr='Instances.Instance[0].Status' to=Running
Use product plugins
aliyun plugin search <command-name>
aliyun plugin install --name <plugin-name>
aliyun plugin list
aliyun plugin update --name <plugin-name>

See command usage and plugin management for the complete workflows.

Troubleshoot

OpenAPI Troubleshoot helps diagnose OpenAPI request failures by RequestId or error message.

Documentation

TopicEnglish简体中文
Documentation indexEnglish中文
Installation and upgradeGuide指南
Configuration and credentialsGuide指南
Commands, output, and automationGuide指南
MCP, OpenTelemetry, and machine interfacesGuide指南
Built-in OSS automationGuide指南
Plugin managementGuide指南

Additional resources:

Support

License

Alibaba Cloud CLI is licensed under the Apache License 2.0.

Comments

Markdown supported