This topic describes how to call the DescribeImages operation by using Alibaba Cloud command-line interface (CLI) to query images.

Background information

You can call the DescribeImages operation to query available images. For more information, see DescribeImages.

When you call an API operation through Alibaba Cloud CLI, make sure that request parameter values of different data types are in required formats. For more information, see Parameter format overview.

Example 1: Query information about an image by using its ID

Query information about the image with the ID of m-bp1cz8on60352qnm****.

aliyun ecs DescribeImages --RegionId cn-hangzhou --ImageId m-bp1cz8on60352qnm**** --output cols=ImageName,Status,OSNameEn,OSType,Progress,Usage rows=Images.Image[]

Sample response:

ImageName | Status    | OSNameEn           | OSType | Progress | Usage
--------- | ------    | --------           | ------ | -------- | -----
namedemo  | Available | CentOS  7.4 64 bit | linux  | 100%     | none

Example 2: Query information about images in a specific state by page

Query information about images in a specific state by page, for example, available.

In this example, display the five entries on the first page.

aliyun ecs DescribeImages --RegionId cn-hangzhou --Status Available --PageNumber 1 --PageSize 5 --output cols=ImageName,Status,OSNameEn,OSType,Progress,Usage rows=Images.Image[]

Sample response:

ImageName   | Status    | OSNameEn                                                       | OSType  | Progress | Usage
---------   | ------    | --------                                                       | ------  | -------- | -----
namedemo1   | Available | CentOS_64                                                      | linux   | 100%     | none
namedemo2   | Available | CentOS  7.6 64 bit                                             | linux   | 100%     | none
namedemo3 | Available | CentOS 7.4 64 bit | linux | 100% | none
namedemo4   | Available | CentOS  7.2 64 bit                                             | linux   | 100%     | none
namedemo5   | Available | Windows Server  2016 Data Center Edition 64bit Chinese Edition | windows | 100%     | instance

Example 3: Query information about an image that is bound with a specific tag

Query information about an image that is bound with tag owner:zhangsan.

aliyun ecs DescribeImages --RegionId cn-hangzhou --Tag.1.Key owner --Tag.1.Value zhangsan --output cols=ImageName,Status,OSNameEn,OSType,Progress,Usage rows=Images.Image[]

Sample response:

ImageName | Status    | OSNameEn           | OSType | Progress | Usage
--------- | ------    | --------           | ------ | -------- | -----
namedemo  | Available | CentOS  7.6 64 bit | linux  | 100%     | none