The Alibaba Cloud CLI lets you call Serverless App Engine (SAE) APIs directly from the command line to manage applications, namespaces, and other resources.
Install the CLI
Install the Alibaba Cloud CLI by following the instructions for your operating system:
Configure the CLI
To configure the Alibaba Cloud CLI, see Overview.
Generate sample CLI commands
-
Go to the SAE API debugging page.
-
On the API Explorer page, search for the desired API in the search box on the left. In the Parameter Configuration section, enter the required parameters and click the CLI Example tab to the right of the Parameter Configuration section to generate a sample command.
-
Click Run Command
to open Cloud Shell and debug the command online. -
Click Copy
to copy the sample command to your clipboard and run it in a local terminal.-
When debugging a sample command locally, verify the parameter formats. For details, see Parameter formats.
-
OpenAPI Explorer automatically adds the
--regionoption to generated sample commands. This option takes precedence over the region in your default credential configuration and environment variables. Remove or keep it as needed.
-
-
Use the CLI to call APIs
For basic usage, see Command structure. Before calling SAE APIs, review the SAE API overview and the request and response parameters for each API.
Fields of different data types must follow the parameter format requirements of the Alibaba Cloud CLI. For details, see Parameter formats.
The following examples show how to call APIs by using the CLI:
-
Create an application:
aliyun sae CreateApplication --AppName test --NamespaceId cn-shenzhen --PackageType=Image --Replicas=2 --ImageUrl=registry-vpc.cn-shenzhen.aliyuncs.com/sae-demo-image/consumer:1.0 --Cpu 1000 --Memory 2048 --Deploy=true -
List applications:
aliyun sae ListApplications --region cn-beijing
Suggestions
For complex tasks that require multiple API calls, organize the CLI commands into a shell script to improve efficiency.