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.
- Modify critical system files.
- Migrate instances from a classic network to a VPC.
- Back up service data.
- Recover mistakenly released instances.
- Mitigate network attacks.
- Change the operating system.
- Provide data support for a production environment.
Additionally, you can use a snapshot to create a custom image to quickly deploy an application environment for a large number of ECS instances.
- 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:
- Log on to the ECS console.
- In the left-side navigation pane, choose .
- Find the instance for which you want to create a snapshot, and then click Manage in the Actions column.
- 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.
- Enter a name for the snapshot and click OK.
- In the left-side navigation pane, click Instance Snapshots. The snapshot creation progress, estimated time remaining, and snapshot status are
You can also create a snapshot as indicated on thepage.
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.
- 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:
- In your local computer, you can obtain the instance ID by calling DescribeInstances:
aliyun ecs DescribeInstances --output cols=InstanceId,InstanceName
- 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:
- Obtain the disk ID by calling the API DescribeDisks:
aliyun ecs DescribeDisks --RegionId cn-hangzhou --InstanceId 'i-0xi1ioe********166cq' --output cols=DiskId
- Call CreateSnapshot to create a snapshot based on the disk ID:
aliyun ecs CreateSnapshot --DiskId d-bp19pjyf12hebpXXXXXXThe snapshot-creating task is initiated if the following information is returned:
- Call DescribeSnapshots to query the progress. When
"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
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: