All Products
Search
Document Center

:Alibaba Cloud CLI

Last Updated:Feb 27, 2024

This topic describes how to use Alibaba Cloud CLI to call API operations.

Alibaba Cloud CLI

You can run aliyun commands to interact with Alibaba Cloud services and manage cloud service resources. For more information, see What is Alibaba Cloud CLI?

Determine whether CLI calls are supported

  1. Read the documentation of the cloud products that you use.

  2. Go to OpenAPI Explorer, and search for the API that you want to call. Click API Debugging in the top navigation bar, and click the CLI Example tab on the right side of the page. If sample commands are available, the current product supports CLI calls.

Scenarios

No GUI on server

On your servers, operating systems that do not come with GUIs are installed, so you cannot use a browser or log on to the Alibaba Cloud console.

Script execution

You want to manage cloud resources by using scripts.

Sample command

Check the running status of all Elastic Compute Service (ECS) instances in the China (Hangzhou) region.

aliyun ecs DescribeInstanceStatus --region cn-hangzhou --RegionId 'cn-hangzhou'

Sample result:

{
  "InstanceStatuses": {
    "InstanceStatus": [
      {
        "InstanceId": "i-bp16loo9hwbtimz4w***",
        "Status": "Running"
      }
    ]
  },
  "PageNumber": 1,
  "PageSize": 10,
  "RequestId": "5B5C840F-D336-56EE-9B18-2A10C4C18***",
  "TotalCount": 1
}