Alibaba Cloud CLI - Controlling your cloud
Published: 2021-10-31 17:04:04

Alibaba Cloud is one of the leading cloud providers in the APAC region. It offers several automation tools out of the box &mdash; inside the Alibaba Cloud portal as well as command-line tools. In this post, we will take a look at the command-line tools (here after addressed as CLI). 

## Availability of Alibaba Cloud CLI

The [Alibaba Cloud CLI](https://www.alibabacloud.com/help/product/29991.htm) is an [open source command-line interface](https://github.com/aliyun/aliyun-cli) to the Alibaba Cloud servers and platform. The CLI is available on all major platforms:

1. Windows
1. macOS
1. Linux

You can run the CLI to provision new resources or manage existing ones. 

> You can perform all the tasks from the Alibaba Cloud portal as well, but with the CLI you can automate these tasks; think of CI/CD and DevOps.

## Features

Alibaba Cloud CLI offers the features of Alibaba Cloud platform in your terminal, but it sometimes lags behind. Most of the latest features would first be available through the portal and then made publicly available in the CLI. 

You can control multiple accounts with the CLI, and work with multiple projects in the same pipeline. The CLI also provide output as expected by the admin of the cloud services. For example, you can get the output in a [table format](https://www.alibabacloud.com/help/doc-detail/122111.htm?spm=a2c63.l28256.a3.17.7b52a893C6jEZ1). Some services on Alibaba Cloud [return the results in a long time](https://www.alibabacloud.com/help/doc-detail/122114.htm?spm=a2c63.p38356.b99.21.34c64573rcpV0S), or they might mutate the results over time and that is where CLI will help you listen to updates over time and show them.

You can also run [Alibaba Cloud CLI in a Docker environment](https://www.alibabacloud.com/help/doc-detail/110805.htm?spm=a2c63.l28256.a3.25.7b52a893C6jEZ1). This is helpful especially when you want to run some commands during the resource uptime. 

As a plus point, or for the benefit of overall development experience, Alibaba Cloud CLI also offers [auto-completion for your commands](https://www.alibabacloud.com/help/doc-detail/122038.htm?spm=a2c63.l28256.a3.12.7b52a893C6jEZ1) in the bash terminals.

## Using Alibaba Cloud CLI

In order to use the Alibaba Cloud CLI, you would need to [configure the credentials](https://www.alibabacloud.com/help/doc-detail/110341.htm?spm=a2c63.l28256.a3.9.7b52a893C6jEZ1) that the CLI will use while communicating with the servers / platform.

You can start with the configure command for `aliyun`.

```
aliyun configure
```

Alibaba Cloud allows you to use it with RPC-like commands, as well as REST API commands. For the API commands, you can use the `GET`, `POST`, etc. verbs and perform the operation. For the RPC you can send the command directly to the server. 

For example you can use the `aliyun ecs <command>`, such as `aliyun ecs StopInstance`. Check the [sample commands](https://www.alibabacloud.com/help/doc-detail/110848.htm?spm=a2c63.l28256.a3.26.7b52a893C6jEZ1) to learn more about this behavior. You can also use the [`help` command](https://www.alibabacloud.com/help/doc-detail/122046.htm?spm=a2c63.l28256.a3.16.7b52a893C6jEZ1) to learn more about the commands; such as `aliyun ecs help`.

## Conclusion
Well, that's pretty much it about the Alibaba Cloud CLI. Alibaba Cloud is actively developing and maintaining their CLI, and you can review their code or contribute to the code base as you like.