All Products
Search
Document Center

Elastic Compute Service:attach a data disk

Last Updated:Mar 14, 2024

Preemptible instances may be forcefully reclaimed due to price fluctuations or changes in supply and demand. If important data is stored on your preemptible instance, you can configure the system disk or data disks of the instance not to be released with the instance to prevent data loss. This way, the system disk or data disks are retained as data disks when the instance is released. This topic describes how to configure the system disk or data disks of a preemptible instance not to be released with the instance when you create the instance and how to attach the disks as data disks to a new instance to restore data after the preemptible instance is reclaimed.

Working principles

When you create a preemptible instance, you can configure the system disk or data disks of the instance not to be released with the instance. When the preemptible instance is forcefully reclaimed, the system disk or data disks of the instance are retained as data disks. You can use the retained disks to restore the data of the preemptible instance.

The following figure shows the O&M workflow in this scenario.

image

Step 1: Create a preemptible instance

When you create a preemptible instance, configure the system disk or data disks not to be released with the instance. For information about how to create a preemptible instance, see Create an instance on the Custom Launch tab.

When you create a preemptible instance, take note of the following basic settings:

  • Set the Billing Method parameter to Preemptible Instance.选择抢占式实例

  • In the Storage section, clear Release with Instance for disks.基础配置时取消云盘随实例释放

Step 2: Attach data disks

Important

For information about the prerequisites for attaching data disks, see Attach a data disk.

You can select or create an instance to attach the retained data disks. For information about how to create an instance, see Create an instance on the Custom Launch tab.

This section describes how to attach a data disk on the Instances page.

Note

You can also choose Storage & Snapshots > Disks in the left-side navigation pane of the ECS console. Find the disk that you want to attach and click Attach in the Actions column to attach the disk to an instance.

  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 the region and resource group to which the resource belongs. 地域

  4. Find the instance to which you want to attach the data disks and click the instance ID.

  5. Click the Cloud Disk tab. In the upper-left corner of the Cloud Disk tab, click Attach Disks.

  6. In the Attach Disk dialog box, configure parameters to attach a disk.

    挂载数据盘到新实例

    1. Select the disk that you want to attach and configure the release settings for the disk. The following table describes the parameters.

      Parameter or option

      Description

      Disk

      Select the disk that you want to attach.

      Note

      You can choose Storage & Snapshots > Disks to view the information of the retained disks of the reclaimed preemptible instance in the disk list.

      Release Disk with Instance

      If you select this option, the disk is automatically released when the instance is released. If you do not select this option, the disk is retained when the instance is released.

      Delete Automatic Snapshots While Releasing Disk

      If you select this option, the automatic snapshots of the disk are released when the disk is released. We recommend that you do not select this option and instead retain the automatic snapshots of the disk.

    2. Click Next.

      If a data disk is attached to the new instance, a message appears indicating that the disk is attached to the instance, and the disk enters the In Use state.