×
Community Blog How Do I Create Snapshots In Alibaba Cloud ECS to Ensure Disaster Recovery?

How Do I Create Snapshots In Alibaba Cloud ECS to Ensure Disaster Recovery?

This article explains how to use Alibaba Cloud ECS Snapshot to assist disaster recovery.

1

Effective disaster recovery is one of the most critical capabilities of an organization and users of cloud-based compute services such as Alibaba Cloud Elastic Compute Service (Alibaba Cloud ECS) can minimize risk and damage with the efficient use of snapshots – point-in-time backups of a disk or disks.

Alibaba Cloud provides a snapshot backup service that enables businesses to create crash-consistent snapshots (which capture the state of data and disk at a point at which an incident occurs) for all disk categories, and can help back up data, create images and implement disaster recovery for applications.

Snapshots can be used for a range of scenarios, including:

  • Disaster recovery and backup: Businesses can create a snapshot for a disk and use that snapshot to create another disk to implement zone- or geo-disaster recovery.
  • Environment clone: Organizations can use a system disk snapshot to create a custom image that can then be used to generate ECS instances with identical environments.
  • Data development: Snapshots can provide near-real-time production data for applications such as data mining, report queries, and development and testing.
  • Enhancement of fault tolerance: Businesses can roll a disk back to a previous point in time by using a snapshot to reduce the risk of data loss caused by incorrect operations. You may create snapshots on a regular basis to prevent losses caused by incorrect operations such as writing incorrect data to disks, accidentally releasing ECS instances, data errors caused by application errors, and data loss due to hacking, or before the performance of high-risk O&M operations, such as replacing operating systems, upgrading applications, and migrating data.

Alibaba Cloud also provides local snapshot capability that ensures the availability of complete copies of disk data at specific points, with the snapshots stored in the same storage cluster as their source disks for fast backup and recovery of data. When disk data is lost, businesses can use a snapshot to restore the disk data to the point in time when the snapshot was created. These snapshots are best suited to scenarios such as:

  • Backup of key business systems that contain a large amount of data, such as databases, containers, and SAP HANA.
  • Backup of data before the performance of high-risk operations to reduce waiting time, such as replacing system disks, resizing disks, and updating system patches.

In this article, we will look at how to activate ECS Snapshot, create a snapshot for a disk and create a local snapshot, to help minimize data loss and service disruption in the event of an incident.

Activating ECS Snapshot

To activate Alibaba Cloud ECS Snapshot:

  • Log on to the ECS console.
  • In the left-side navigation pane, choose Storage & Snapshots > Snapshots.
  • View the statement on the Notifications message that appears, and click OK to activate the snapshot service.

1

Creating a snapshot for a disk

Prerequisites

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

Background information

It can take several minutes to create a snapshot, based on the size of the disk and because the first snapshot of each disk is a full snapshot, it takes longer to create. Subsequent snapshots of the disk are incremental snapshots. It does not take as long to create an incremental snapshot, and the amount of time required varies based on the amount of data changed since the previous snapshot. The more data that has changed, the longer it takes.

When creating a snapshot, take note of the following items:

  • Do not perform operations that change the state of the ECS instance, such as stopping or restarting the instance.
  • Snapshots are charged for. For more information, see Snapshots.
  • Alibaba Cloud recommends you create snapshots during off-peak hours because snapshot creation degrades the I/O performance of disks by up to 10% and slows down data reads and writes.
  • While snapshots are being created, the incremental data generated by disk operations is not included in the snapshots.
  • If an extended volume is created from a single multi-partition disk, the snapshot that created can be used to roll back the disk.
  • When a disk is used to create a dynamic extended volume or a RAID array, Alibaba Cloud recommends creation of a snapshot-consistent group and enable the application-conssistent snapshot feature.
  • Created snapshots are permanently stored unless you delete them. We recommend that users delete unnecessary snapshots on a regular basis to prevent extra fees incurred by snapshot storage.

Create a snapshot in the ECS console

To create a snapshot for a disk, go to the Instances page in the ECS console and perform the following operations:

  • Log on to the ECS console.
  • In the left-side navigation pane, choose Instances & Images > Instances.
  • In the top navigation bar, select a region.
  • Find the instance to which the disk is attached and click the instance ID.
  • On the Instance Details page, click the Cloud Disk tab.
  • Find the disk for which you want to create a snapshot and click Create Snapshot in the Actions column.
  • In the Create Snapshot dialog box, configure the parameters described in the following table, and then click Create.
Parameter Description
Snapshot Name The name of the snapshot.
The name cannot start with auto because a snapshot whose name starts with auto is recognized as an automatic snapshot.
Instant Access The instance access feature can accelerate the process of snapshot creation. You can use the instant access feature to create snapshots within seconds.
If you are using an enhanced SSD (ESSD), you can turn on Instant Access. For more information, see Enable or disable the instant access feature.
Duration of Instant Access The number of days during which the instant access feature is available. The instant access feature is automatically disabled when the specified duration of instant access expires.
Tag The tag key and value of the snapshot.

After the snapshot is created, you can click the Snapshot tab on the Instance Details page to view the created snapshot.

You can also create a snapshot for a disk on the Disks page in the ECS console. To go to the Disks page, choose Storage & Snapshots > Disks in the left-side navigation pane.

Create a snapshot by using Alibaba Cloud CLI (Alibaba Cloud Command Line Interface)

  • Obtain the instance ID.

    • Method 1: If you are connected to the ECS instance, you can obtain the instance ID from the instance metadata. For more information, see Overview of ECS instance 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[]
  • Call the DescribeDisks operation to obtain the disk ID.
  • aliyun ecs DescribeDisks --RegionId <TheRegionId> --InstanceId i-bp1afnc98r8k69****** --output cols=DiskId rows=Disks.Disk[]
  • Call the CreateSnapshot operation to create a snapshot for a specified disk.
  • aliyun ecs CreateSnapshot --DiskId d-bp19pjyf12hebp******
  • If the task to create a snapshot is initiated, the following response is returned:
  • null
  • Call the DescribeSnapshots operation to query the snapshot creation progress.
  • aliyun ecs DescribeSnapshots --RegionId cn-hangzhou --InstanceId i-bp1afnc98r8k69****** --output cols=SnapshotId,Status rows=Snapshots.Snapshot[]
  • If the snapshot is created, both "SnapshotId"="s-bp1afnc98r8kjh******" and "Status":"accomplished" are displayed.

Creating a local snapshot

Prerequisites for a local snapshot

  • 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.

Background information

A local snapshot takes seconds to create, whereas a normal snapshot takes minutes.

When create a snapshot, take note of the following items:

  • Local snapshots can be created only for ESSDs.
  • Organizations must not perform operations that change the state of the ECS instance such as stopping or restarting the instance.
  • While snapshots are being created, incremental data generated by operations on disks will not be included in the snapshots.
  • If an extended volume is created from a single multi-partition disk, the snapshot created can be used to roll back the disk.
  • When a disk is used to create a dynamic extended volume or RAID array, organizations should 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 creating a snapshot.
  • Created snapshots are permanently stored unless you delete them. We recommend that unnecessary snapshots are deleted at regular intervals to prevent extra fees incurred by snapshot storage.

Create a local 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.

2

5.  The Instance Details tab appears. Click the Cloud Disk tab.
6.  Select an enhanced SSD (ESSD), and then click Create Snapshot in the Actions column.

3

You can create a local snapshot for a disk only when the disk meets the following conditions:

  1. Disk category: ESSD
  2. Encryption status: unencrypted
  3. Disk type: system disk or data disk

7.  In the dialog box that appears, complete the following operations:

4

  • Enter a snapshot name in the Snapshot Name field.
  • Select Create Local Snapshot.
  • Set the Retention Period parameter.
  • Optional: Binds one or more tags to the snapshot.
  • Click Create.

8.  After the Instance Details tab appears, click the Snapshot tab.
The normal snapshots and local snapshots that are created for the ESSD are displayed on the Snapshots page.

5

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 local 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.
3.  aliyun ecs DescribeDisks --RegionId <TheRegionId> --InstanceId i-bp1afnc98r8k69****** --output cols=DiskId rows=Disks.Disk[]
4.  Call the CreateSnapshot operation to create a snapshot based on a specified disk.
5.  aliyun ecs CreateSnapshot --DiskId d-bp19pjyf12hebp****** --Category flash
6.  The snapshot creation task is initiated if the following information is returned:
7.  {"RequestId":"16B856F6-EFFB-4397-8A8A-CB73FA******","SnapshotId":"s-bp1afnc98r8kjh******"}
8.  Query the snapshot creation progress by calling the DescribeSnapshots operation.
9.  aliyun ecs DescribeSnapshots --RegionId cn-hangzhou --InstanceId i-bp1afnc98r8k69****** --output cols=SnapshotId,Status rows=Snapshots.Snapshot[]
10.  If both "SnapshotId"="s-bp1afnc98r8kjh******" and "Status":"accomplished" are displayed, the snapshot is created.

After you create a snapshot, you can:

Taking these steps to set up Alibaba Cloud ECS Snapshots enables you to operate with greater confidence thanks to the increased resilience of your systems and applications.

0 0 0
Share on

Iain Ferguson

31 posts | 2 followers

You may also like

Comments

Iain Ferguson

31 posts | 2 followers

Related Products