DATASOURCE::ECS::Snapshots is used to query all snapshots of an Elastic Compute Service (ECS) instance or a disk.

Syntax

{
  "Type": "DATASOURCE::ECS::Snapshots",
  "Properties": {
    "Status": String,
    "Usage": String,
    "Category": String,
    "KMSKeyId": String,
    "ResourceGroupId": String,
    "InstanceId": String,
    "Encrypted": Boolean,
    "SnapshotLinkId": String,
    "SnapshotIds": List,
    "SnapshotName": String,
    "Filters": List,
    "SnapshotType": String,
    "SourceDiskType": String,
    "Tags": List,
    "DiskId": String
  }
}

Properties

Property Type Required Editable Description Constraint
Status String No Yes The state of the snapshot. Default value: all. Valid values:
  • progressing: The snapshot is being created.
  • accomplished: The snapshot is created.
  • failed: The snapshot fails to be created.
  • all: all snapshot states.
Usage String No Yes Specifies whether the snapshot is used to create custom images or disks. Valid values:
  • image: The snapshot is used to create custom images.
  • disk: The snapshot is used to create disks.
  • image_disk: The snapshot is used to create custom images and disks.
  • none: The snapshot is not used.
Category String No Yes The category of the snapshot. Valid values:
  • Standard: normal snapshot
  • Flash: local snapshot
KMSKeyId String No Yes The ID of the Key Management Service (KMS) key that is used to encrypt the data disk. None.
ResourceGroupId String No Yes The ID of the resource group. When you use this property to filter resources, the number of resources that are contained in the specified resource group cannot exceed 1,000.
InstanceId String No Yes The ID of the instance. None.
Encrypted Boolean No Yes Specifies whether to query encrypted snapshots. Default value: false. Valid values:
  • true
  • false
SnapshotLinkId String No Yes The ID of the snapshot chain. None.
SnapshotIds List No Yes The list of snapshot IDs. You can specify up to 100 IDs. Separate multiple IDs with commas (,).
SnapshotName String No Yes The name of the snapshot. None.
Filters List No Yes The filters that are used to query resources. You can specify up to two filters.

For more information, see Filters properties.

SnapshotType String No Yes The type of snapshot creation. Default value: all. Valid values:
  • auto: automatic creation
  • user: manual creation
  • all: all creation types
SourceDiskType String No Yes The type of the source disk. Valid values:
  • system: system disk
  • data: data disk
Tags List No Yes The tags of the snapshot. You can specify up to 20 tags.

For more information, see Tags properties.

DiskId String No Yes The ID of the disk. None.

Filters syntax

"Filters": [
  {
    "Value": String,
    "Key": String
  }
]

Filters properties

Property Type Required Editable Description Constraint
Value String No No The value of the filter that is used to query resources. The time must be in UTC+0.

Specify the time in the yyyy-MM-ddTHH:mmZ format.

Key String Yes No The key of the filter that is used to query resources. Valid values:
  • CreationStartTime: the beginning of the time range during which resources are created.
  • CreationEndTime: the end of the time range during which resources are created.

Tags syntax

"Tags": [
  {
    "Value": String,
    "Key": String
  }
]

Tags properties

Property Type Required Editable Description Constraint
Value String No No The tag value of the snapshot. The tag value must be 0 to 128 characters in length, and cannot contain http:// or https://. The tag value cannot start with aliyun or acs:.
Key String Yes No The tag key of the snapshot. The tag key must be 1 to 128 characters in length, and cannot contain http:// or https://. The tag key cannot start with aliyun or acs:.

Return values (Fn::GetAtt)

  • SnapshotIds: the IDs of snapshots.
  • Snapshots: details of the snapshots.
Property Type Description Constraint
SnapshotIds List The IDs of snapshots. Example: ["s-bp67acfmxazb4p****", "s-bp67acfmxazb5p****", … "s-bp67acfmxazb6p****"].
Snapshots List Details of the snapshots. None.
Status String The state of the snapshot. Valid values:
  • progressing: The snapshot is being created.
  • accomplished: The snapshot is created.
  • failed: The snapshot fails to be created.
Progress String The creation progress of the snapshot. Unit: percentage.

Example: 100%.

Usage String Indicates whether the snapshot is used to create custom images or disks. Valid values:
  • image: The snapshot is used to create custom images.
  • disk: The snapshot is used to create disks.
  • image_disk: The snapshot is used to create custom images and data disks.
  • none: The snapshot is not used.
Description String The description of the snapshot. None.
Category String The category of the snapshot. Valid values:
  • Standard: normal snapshot
  • Flash: local snapshot
KMSKeyId String The ID of the KMS key that is used to encrypt the data disk. None.
ProductCode String The product code of the Alibaba Cloud Marketplace image. None.
Encrypted Boolean Indicates whether the snapshots are encrypted. Valid values:
  • true
  • false
SnapshotName String The name of the snapshot. None.
SourceDiskId String The ID of the source disk. This property is retained even after the source disk of the snapshot is released.
SourceStorageType String The type of the source disk. None.
SnapshotId String The ID of the snapshot. None.
SnapshotSN String The serial number of the snapshot. None.
SourceDiskSize String The size of the source disk. Unit: GiB.
SnapshotType String The type of snapshot creation. Valid values:
  • auto: automatic creation
  • user: manual creation
SourceDiskType String The type of the source disk. Valid values:
  • system: system disk
  • data: data disk
Tags List The tags. Example: [{'Value': 'value_test', 'Key': 'test123'}].

Examples

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "SnapshotName": {
      "Type": "String",
      "Description": "The name of the snapshot.",
      "Default": "auto_20150730_3"
    }
  },
  "Resources": {
    "ExtensionDataSource": {
      "Type": "DATASOURCE::ECS::Snapshots",
      "Properties": {
        "SnapshotName": {
          "Ref": "SnapshotName"
        }
      }
    }
  },
  "Outputs": {
    "SnapshotIds": {
      "Description": "the list of snapshot ids.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionDataSource",
          "SnapshotIds"
        ]
      }
    },
    "Snapshots": {
      "Description": "the list of snapshots.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionDataSource",
          "Snapshots"
        ]
      }
    }
  }
}