A snapshot is a backup file of the data on a disk for a specific point in time. A snapshot is used for data backup, data recovery after accidental instance releases, data recovery after network attacks, and the creation of custom images. You can create snapshots of disks to improve fault tolerance for operations before you roll back a disk, modify key system files, or change the operating system of an instance. This topic describes how to create a normal snapshot in the ECS console or by calling an API operation in Alibaba Cloud CLI.
- The ECS instance must be in the Running or Stopped state.
- The disk must be in the In Use or Expired state.
Note If a disk in the Expired state reaches its scheduled release time when a snapshot is being created for the disk, the snapshot in the Creating (Creating) state will also be released together with the disk.
- 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 Snapshot billing methods.
- 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:
- Log on to the ECS console.
- In the left-side navigation pane, choose .
- In the top navigation bar, select a region.
- Find the ECS instance for which you need to create a snapshot, click the instance
ID, or click Manage in the Actions column corresponding to the instance to go to the Instance Details page.
- In the left-side navigation pane, click Disks.
- Select a disk category, select System Disk or Data Disk for Type, and then click Create Snapshot in the Actions column.
- In the dialog box that appears, complete the following operations:
- Enter a snapshot name in the Snapshot Name field.
- Binds one or more tags to the snapshot.
- Click OK.
- In the left-side navigation pane, click Snapshots to view the snapshot task.
You can also choosefrom the left-side navigation pane in the ECS console to create a snapshot for a disk as prompted.
Create a snapshot by using Alibaba Cloud CLI
- 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:
- 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
- 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.
- Obtain the disk ID by calling the DescribeDisks operation.
aliyun ecs DescribeDisks --RegionId <TheRegionId> --InstanceId i-bp1afnc98r8k69****** --output cols=DiskId rows=Disks.Disk
- 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:
- 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
"Status":"accomplished"are displayed, the snapshot is created.