The Alibaba Cloud snapshot service is an agentless backup service that allows you to create crash-consistent snapshots for system disks or data disks. You can use snapshots to back up data, restore instances that were released by mistake, and create custom images. Before you roll back disks, modify key system files, or replace operating systems, you can create snapshots to improve fault tolerance. This topic describes how to create a snapshot by using the ECS console or by calling an API operation.

Prerequisites

  • The disk is in the In Use or Unattached state.
  • If the disk is in the In Use state, the instance is in the Running or Stopped state.

Background information

It takes you several minutes to create a normal snapshot, and the specific duration of time depends on the size of the disk. The first snapshot of a disk is a full snapshot, so creating the first snapshot takes an extended period of time. Creating subsequent snapshots takes less time, but the duration of time depends on the amount of data changed since the last snapshot. The more that has changed, the longer it will take.

Take note of the following points when you create a snapshot:
  • You must not perform operations that change the state of the ECS instance such as stopping or restarting the instance.
  • Snapshots are billed resources. For more information, see Snapshots.
  • We recommend that you create snapshots during off-peak hours because snapshot creation degrades the I/O performance of disks by up to 10% and lowers data read/write speeds.
  • While snapshots are being created, incremental data generated by operations on disks will not be included in the snapshots.
  • If you create an extended volume from a single multi-partition disk, the snapshot that you created can be used to roll back the disk.
  • When a disk is used to create a dynamic extended volume or RAID array, we recommend that you stop applications from writing data to the dynamic extended volume or RAID array and refresh the cached data to the disk. Stop all I/O operations before you create a snapshot.
  • Created snapshots are permanently stored unless you delete them. We recommend that you delete unnecessary snapshots at regular intervals to prevent extra fees incurred by snapshot storage.

Create a normal snapshot from the ECS console

The following operations demonstrate how to create a snapshot for an instance from the Instances page in the ECS console:

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Instances & Images > Instances.
  3. In the top navigation bar, select a region.
  4. Find the ECS instance for which you need to create a snapshot, click the instance ID, or click Manage in the Actions column.
    Manage
  5. The Instance Details tab appears. Click the Cloud Disk tab.
  6. Find the disk and click Create Snapshot in the Actions column.
    Note You can also select appropriate values for headers of the disk list such as Disk Category (All), Status (All), and Type (All) to quickly find the disk.
    Disk type
  7. In the dialog box that appears, enter a snapshot name, bind a tag, and then click Create.
    Note You can also create a local snapshot for an Enhanced SSD disk. If you do not select Create Local Snapshot in this dialog box, a normal snapshot is created.
    Create a normal snapshot
  8. After the Instance Details tab appears, click the Snapshot tab to view the created snapshot.
    Snapshots

You can also choose Storage & Snapshots > Disks from the left-side navigation pane of the ECS console to create a snapshot for a disk.

Create a snapshot by using Alibaba Cloud CLI

  1. Obtain the instance ID.
    • Method 1: If you have connected to the ECS instance, you can obtain the instance ID from the instance metadata. For more information, see Metadata.
      For example, to query the ID of a Linux instance, run the following command:
      curl http://100.100.100.200/2016-01-01/meta-data/instance-id
    • Method 2: Use Alibaba Cloud CLI to call the DescribeInstances operation to obtain the instance ID.
      aliyun ecs DescribeInstances --RegionId <TheRegionId> --output cols=InstanceId,InstanceName rows=Instances.Instance[]
  2. Obtain the disk ID by calling the DescribeDisks operation.
    aliyun ecs DescribeDisks --RegionId <TheRegionId> --InstanceId i-bp1afnc98r8k69****** --output cols=DiskId rows=Disks.Disk[]
  3. Call the CreateSnapshot operation to create a snapshot based on a specified disk.
    aliyun ecs CreateSnapshot --DiskId d-bp19pjyf12hebp******
    The snapshot creation task is initiated if the following information is returned:
    {"RequestId":"16B856F6-EFFB-4397-8A8A-CB73FA******","SnapshotId":"s-bp1afnc98r8kjh******"}
  4. Query the snapshot creation progress by calling the DescribeSnapshots operation.
    aliyun ecs DescribeSnapshots --RegionId cn-hangzhou --InstanceId i-bp1afnc98r8k69****** --output cols=SnapshotId,Status rows=Snapshots.Snapshot[]
    If both "SnapshotId"="s-bp1afnc98r8kjh******" and "Status":"accomplished" are displayed, the snapshot is created.

What to do next