This topic describes how to create a snapshot. A snapshot is a copy of data on a disk at a specific point in time. Snapshots are commonly used to back up data and create custom images.

Scenarios

You can create a snapshot in data backup scenarios to eliminate the risk of data loss. Specifically, you can create a snapshot if you need to:

Additionally, you can use a snapshot to create a custom image to quickly deploy an application environment for a large number of ECS instances.

Limits

  • Snapshots are charged based on the storage resources you actually use. For more information, see Billing of snapshots.
  • Creating a snapshot may have a slight impact on disk performance and I/O speeds. We recommend that you create snapshots during off-peak hours.
  • A snapshot only records data at a specific point in time. Therefore, incremental data generated when the snapshot is created will not be synchronized to the snapshot.
  • To ensure that a snapshot is successfully created, we recommend that you do not modify the ECS instance status (that is, stop or restart the instance) when the snapshot is being created.
  • If you want to create a snapshot of an instance, the instance must be in the Running or Stopped state.
  • If you want to create a snapshot of a disk, the disk must be in the Running state.
  • Manually created snapshots can only be manually deleted. Therefore, you need to delete unnecessary snapshots regularly to prevent these snapshots from incurring fees.
  • If you create an extended volume by using a multi-partition single disk, the snapshot that you created can be used to roll back the disk.
  • If you create a dynamic extended volume by using multiple disks and no I/O operation is performed on data in the volume, the snapshot that you created can be used to roll back the disk. If I/O operations are continuously performed in the extended volume, data consistency of the rolled-back disk is uncertain.

Create a snapshot in the ECS console

To create a snapshot in the ECS console, follow these steps:

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Instances & Images > Instances.
  3. Find the instance for which you want to create a snapshot, and then click Manage in the Actions column.

  4. In the left-side navigation pane, click Disks, find the target disk, and then click Create Snapshot.
    Note You can select only one disk at a time. The Type can be a system disk or a data disk.


  5. Enter a name for the snapshot and click OK.

  6. In the left-side navigation pane, click Instance Snapshots. The snapshot creation progress, estimated time remaining, and snapshot status are displayed.

You can also create a snapshot as indicated on the Block Storage > Disks page.

Create a snapshot using an API

The following procedure describes how to use Alibaba Cloud CLI to call API actions to create a snapshot. For more information, see Quick start for ECS APIs.

  1. Obtain the instance ID.
    • If you have remotely connected to an ECS instance, you can obtain the instance ID by using 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
    • In your local computer, you can obtain the instance ID by calling DescribeInstances:
      aliyun ecs DescribeInstances --output cols=InstanceId,InstanceName
  2. Obtain the disk ID by calling the API DescribeDisks:
    aliyun ecs DescribeDisks --RegionId cn-hangzhou --InstanceId 'i-0xi1ioe********166cq' --output cols=DiskId
  3. Call CreateSnapshot to create a snapshot based on the disk ID:
    aliyun ecs CreateSnapshot --DiskId d-bp19pjyf12hebpXXXXXX
    The snapshot-creating task is initiated if the following information is returned:
    {"RequestId":"16B856F6-EFFB-4397-8A8A-CB73FAXXXXXX","SnapshotId":"s-bp1afnc98r8kjhXXXXXX"}
  4. Call DescribeSnapshots to query the progress. When "SnapshotId"="s-bp1afnc98r8kjhXXXXXX" and "Status":"accomplished" are displayed, it means that the snapshot has been created.
    aliyun ecs DescribeSnapshots --RegionId cn-hangzhou --InstanceId i-bp1afnc98r8k69XXXXXX --output cols=SnapshotId,Status

Time required

The time required for creating a snapshot is dependent on the capacity of the disk.

Following the content covered in Snapshot concepts, the first disk snapshot is a full snapshot, and therefore its creation requires a relatively long period of time. In contrast, subsequent snapshots require shorter periods of time. The amount of time needed to create subsequent snapshots is dependent on the amount of data generated since the last snapshot. Generally, the greater the amount of data, the longer time it will take to create the snapshot.

What to do next

After you create a snapshot, you can: