Alibaba Cloud CLI is pre-installed in the Cloud Shell. Alibaba Cloud CLI is a management tool based on the Alibaba Cloud Open API. You can manage your cloud resources by using Alibaba Cloud CLI.
The Alibaba Cloud product APIs are divided into two types, RPC API and RESTful API. Most products use RPC style. The method of calling an API differs from different API types.
You can determine the API type by the following characteristics:
- If an API requires the
Action
parameter, then the API is the RPC type. If an API requires thePathPattern
API, then the API is the RESTful type. - In general, all APIs in a product are of the same type.
- Each API only supports one calling method. An error
ApiNotFound
is returned if a wrong method is used.
Start Cloud Shell
-
Start from Alibaba Cloud console
Click the Cloud Shell icon on the top menu of the Alibaba Cloud console.
-
Start from web browser
Open a web browser and enter https://shell.aliyun.com or open Cloud Shell from the OpenAPI Explorer.
You can open up to 5 Cloud Shell windows simultaneously.
-
A Linux VM will be created when the first time you connect to Cloud Shell. It usually takes 40 seconds.
-
The same VM is connected although multiple Cloud Shell windows are opened. The number of VMs does not increase when a new Cloud Shell window is opened.
Call RPC APIs in Cloud Shell
aliyun <ProductCode> <ActionName> [--parameter1 value1 --paramter2 value2]
Note:
-
ProductCode: The code of the product to call. For example, the product code of ECS is
ecs
and the product code of SLB isslb
. Run thealiyun --help
command to obtain product codes. For more information, see Codes of Alibaba Cloud services. -
ActionName: The API to call. For example, call the
DescribeInstanceAttribute
API to view the detailed information of an ECS instance. -
parameter: The parameters of the API. For more information about each parameter, see the API documentation of each product.
Example
aliyun ecs DescribeInstanceAttribute --InstanceId i-bp198exxxxxx | jq

Call RESTful APIs in the Cloud Sehll
- GET method
aliyun <ProductCode> GET /<Resource>
Examplesaliyun cs GET /clusters
- POST method
aliyun <ProductCode> POST /<Resource> --body "$(cat input.json)"
Examplesaliyun cs POST /clusters//attach --header "Content-Type=application/json" --body "$(cat attach.json)"
- DELETE method
aliyun <ProductCode> DELETE /<Resource>
Examplesaliyun cs DELETE /clusters/<cluster-id>