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.
The APIs for Alibaba Cloud services are divided into two categories: Remote Procedure Call (RPC) API and RESTful API. RPC APIs apply to most services such as Elastic Compute Service (ECS), ApsaraDB RDS, and Server Load Balancer (SLB).
API calling methods vary based on API categories. You can determine the API category by the following characteristics:
RPC APIs contain the Action parameter and RESTful APIs contain the PathPattern parameter.
In most cases, an Alibaba Cloud service uses APIs of the same type.
Start Cloud Shell
To start Cloud Shell in OpenAPI Explorer, perform the following operations:
Open a browser and enter https://next.api.aliyun.com in the address bar to access OpenAPI Explorer.
In the top navigation bar, click Select Cloud Service and select an Alibaba Cloud service.
In the top navigation bar, click API Debugging. On the Debug API page, start Cloud Shell.
Log on to Cloud Shell with your Alibaba Cloud account.
Call a remote procedure call (RPC) API operation in Cloud Shell
Call an RPC API operation in the following format:
aliyun <ProductCode> <ActionName> [--parameter1 value1 --paramter2 value2]
Take note of the following information:
ProductCode: the code of the Alibaba Cloud service whose API operations you want to call, such as
ecs
for Elastic Compute Service (ECS) andslb
for Server Load Balancer (SLB). You can run thealiyun --help
command to view the code of each Alibaba Cloud service.ActionName: the name of the API operation that you want to call. For example, you can call the
DescribeInstanceAttribute
operation to view the details of an ECS instance.parameter: the request parameters you want to configure. For more information, see the API Reference of each Alibaba Cloud service.
Example
Run the following command in Cloud Shell to view the configurations of an ECS instance.
Before you run the command, replace i-bp198exxxxxx with an actual instance ID.
aliyun ecs DescribeInstanceAttribute --InstanceId i-bp198exxxxxx | jq
Call a RESTful API operation in Cloud Shell
Specific Alibaba Cloud services such as Container Service for Kubernetes (ACK) follow the RESTful API standard. The invocation method for RESTful API operations is different from the invocation methods for RPC API operations. The following section describes the required formats when you call RESTful API operations by using different HTTP request methods in Alibaba Cloud CLI and provides several examples.
GET request
aliyun <ProductCode> GET /<Resource>
Example
aliyun cs GET /clusters
POST request
aliyun <ProductCode> POST /<Resource> --body "$(cat input.json)"
Example
aliyun cs POST /clusters//attach --header "Content-Type=application/json" --body "$(cat attach.json)"
DELETE request
aliyun <ProductCode> DELETE /<Resource>
Example
aliyun cs DELETE /clusters/<cluster-id>