DEV Community

Afzaal Ahmad Zeeshan
Afzaal Ahmad Zeeshan

Posted on

Alibaba Cloud CLI - Controlling your cloud

Alibaba Cloud is one of the leading cloud providers in the APAC region. It offers several automation tools out of the box — 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 is an open source command-line interface to the Alibaba Cloud servers and platform. The CLI is available on all major platforms:

  1. Windows
  2. macOS
  3. 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. Some services on Alibaba Cloud return the results in a long time, 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. 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 in the bash terminals.

Using Alibaba Cloud CLI

In order to use the Alibaba Cloud CLI, you would need to configure the credentials that the CLI will use while communicating with the servers / platform.

You can start with the configure command for aliyun.

aliyun configure
Enter fullscreen mode Exit fullscreen mode

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 to learn more about this behavior. You can also use the help command 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.

Latest comments (0)