Cloud Shell is integrated with OpenAPI Explorer. Cloud Shell is a web-based CLI provided by Alibaba Cloud CLI. You can use Cloud Shell without the need to install it or specify an AccessKey pair.
Alibaba Cloud APIs are either RPC or RESTful. Most products (ECS, ApsaraDB RDS, load balancer) use RPC APIs.
Identify the API type by these characteristics:
-
RPC APIs include an Action parameter, while RESTful APIs require a PathPattern parameter.
-
Typically, all API operations for a single cloud product are of the same type.
Start Cloud Shell
Log on to OpenAPI Explorer.
In the top navigation bar, click Select a cloud service. In the panel that appears, select the target cloud service.
In the top navigation bar of the homepage of the cloud service, click API Debugging. On the page that appears, click the CLI Example tab.
On the CLI Example tab, click the
icon to start Cloud Shell. You can also directly go to the page of Alibaba Cloud Shell.
Call an RPC API operation in Cloud Shell
You must comply with the following command format when you call an RPC API operation in Cloud Shell:
aliyun <ProductCode> <ActionName> [--parameter1 value1 --parameter2 value2]Parameter | Description | Example |
| The cloud product code. For example, the product code for Elastic Compute Service (ECS) is You can execute the | Run the following command in Cloud Shell to view the configurations of an ECS instance. Note Replace i-bp198exxxxxx with the ID of the ECS instance. |
| The API operation that you want to call. For example, you can call the | |
| The request parameters. For more information, see the API references of each Alibaba Cloud service. |
Call a RESTful API operation in Cloud Shell
RESTful API applies to specific Alibaba Cloud services such as Container Service for Kubernetes (ACK). RESTful API operations are called in a way different from RPC API operations. The following section provides the formats of commands that are required to call RESTful API operations in Cloud Shell.
GET request
aliyun <ProductCode> GET /<Resource>Example
aliyun cs GET /clustersPOST request
aliyun <ProductCode> POST /<Resource> --body "$(cat input.json)"Example
aliyun cs POST /clusters/<cluster-id> --header "Content-Type=application/json" --body "$(cat attach.json)"DELETE request
aliyun <ProductCode> DELETE /<Resource>Example
aliyun cs DELETE /clusters/<cluster-id>