This topic describes how to call the DescribeSnapshots operation by using Alibaba
Cloud CLI to query all snapshots of an ECS instance or a disk.
Background information
We recommend that you read the description of the operation before you call the operation.
For more information, see DescribeSnapshots.
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 the snapshots of an ECS instance
- Query the ID of the ECS instance by using Alibaba Cloud CLI. For more information,
see Query the details of ECS instances.
- Query the snapshots of the ECS instance based on the instance ID.
In this example, all types of manual snapshots of the
i-bp135vxo2oisz0cx****
instance are queried.
aliyun ecs DescribeSnapshots --RegionId cn-hangzhou --InstanceId i-bp135vxo2oisz0cx**** --Status all --SnapshotType user --output cols=SnapshotId,SnapshotName,Status rows=Snapshots.Snapshot[]
Sample response:
SnapshotId | SnapshotName | Status
---------- | ------------ | ------
s-bp15k4ho3tb8phjr**** | namedemo1 | accomplished
s-bp11y4dhnmouewav**** | namedemo2 | accomplished
Example 2: Query the snapshots of a disk
- Call the DescribeDisks operation to query the ID of the disk for which the target
snapshots are created. For more information, see DescribeDisks.
- Query the snapshots of the disk based on the disk ID.
In this example, all types of manual snapshots of the
d-bp1cs71lqlawiyrn****
disk are queried.
aliyun ecs DescribeSnapshots --RegionId cn-hangzhou --DiskId d-bp1cs71lqlawiyrn**** --Status all --SnapshotType user --output cols=SnapshotId,SnapshotName,Status rows=Snapshots.Snapshot[]
Sample response:
SnapshotId | SnapshotName | Status
---------- | ------------ | ------
s-bp15k4ho3tb8phjr**** | namedemo1 | accomplished
s-bp11y4dhnmouewav**** | namedemo2 | accomplished