All Products
Search
Document Center

Elastic Compute Service:Retain and restore spot instance data

Last Updated:Jul 21, 2026

Preserve spot instance data against interruption by using economical mode, disk retention, or snapshots.

Data retention and restoration

image

Enable the economical mode

When you create a spot instance, set Instance Interruption Mode to Stop in Economical Mode. When interrupted, the system stops the instance in economical mode. Click Start to restore instance data. Note the following items:

  • You can set Instance Interruption Mode only when you create the spot instance. You cannot modify it after creation.

  • The instance may fail to restart due to pricing or inventory factors.

  • After the instance restarts, its static public IP address may change.

Important

If the instance fails to restart due to pricing or inventory factors, restore data from a snapshot or custom image.

Prevent disks from being released with the instance

Before a spot instance is interrupted, configure the system disk and data disks to not be released together with the instance. After reclamation, attach these disks to another instance to restore data. Note the following items:

  • The retained system disk can only be attached to another instance as a data disk.

  • The disks and the target instance must be in the same zone.

Create snapshots or custom images

Create snapshots or custom images from a spot instance after creation. After reclamation, create a new instance from a custom image to restore data. Note the following items:

  • Only system disk snapshots can be used to create custom images.

  • The new instance must be in the same region as the custom image. To use the image in a different region, copy the custom image to the destination region.

Procedure

Enable the economical mode for a spot instance

Flowchart

image

Retain data

Procedure

  1. Log on to the ECS console, go to the instance buy page, and click the Custom Launch tab.

  2. Configure the instance parameters. Note the following parameters. For other parameters, see Create an instance with Custom Launch.

    • Billing Method: Select Spot Instance.

    • Instance Interruption Mode: Select Stop in Economical Mode.

    Note
    • After a spot instance is stopped in economical mode, computing resources (vCPUs, GPUs, and memory), static public IP address, and associated public bandwidth are reclaimed and no longer billed. Billing continues for other resources such as cloud disks (system disk and data disks), elastic IP addresses (if any), and snapshots.

    • To create spot instances by API, call the RunInstances operation and set SpotInterruptionBehavior to Stop to enable the economical mode.

Restore data

Procedure

  1. After you receive an interruption notification, the spot instance is stopped in economical mode within 5 minutes. View the instance status on the ECS console - instances page.

    The spot instance status is displayed as Stopped with the Economical Mode label.

  2. After the spot instance is stopped in economical mode, click Start when the market price does not exceed the bid price and inventory is sufficient. You can also call the StartInstance or StartInstances operation.

    Note

Prevent disks from being released with the instance

Flowchart

image

Retain data

Procedure

When you create a spot instance, configure the system disk or data disks to not be released with the instance:

  1. Log on to the ECS console, go to the instance buy page, and click the Custom Launch tab.

  2. Configure the instance parameters. Note the following parameters. For other parameters, see Create an instance with Custom Launch.

    1. Set Billing Method to Spot Instance. In the Region section, select the target region (for example, China (Hangzhou)).

    2. In the Block Storage section, configure the system disk (for example, Ultra Disk, 40 GiB) and data disks (for example, Ultra Disk, 20 GiB), and clear the Release Disks with Instance check box for both the system disk and data disks.

If you did not clear this option during instance creation, change the disk release mode on the Instance Details or Block Storage page.

Note

To create spot instances by API, call the RunInstances operation and set DeleteWithInstance to false. You can also call the ModifyDiskAttribute operation and set DeleteWithInstance to false.

Restore data

Usage notes

  • The disks are in the Unattached (Available) state.

  • The target instance is in the Running (Running) or Stopped (Stopped) state, and not in the Locked (Locked) state.

Procedure

Note

You can also call the AttachDisk operation to attach a disk to an instance.

Create snapshots or custom images from a spot instance

Flowchart

image

Retain data

Procedure

The following steps describe how to create a snapshot on the Instance page in the ECS console. You can also create snapshots on the Snapshots or Block Storage page.

  1. Go to the ECS console - instances.

  2. In the upper-left corner of the page, select a region and resource group.

  3. Click the instance ID. Select the Snapshots tab and click Create Disk Snapshot.

  4. In the Create Snapshot dialog box, configure the snapshot parameters and then click OK.

    Parameter

    Description

    Resource type

    By default, Cloud Disk is selected to create a snapshot for a single cloud disk.

    Note

    You can also select Instance. Then, select one or more cloud disks from the instance to create a snapshot consistency group and create snapshots for multiple disks within the group. This ensures data consistency across the disks. For more information, see Create a snapshot consistency group.

    Select Cloud Disk

    Select the cloud disk for which you want to create a snapshot. This can be a system disk or a data disk.

    Snapshot name

    Enter a name for the snapshot.

    Retention period

    Set the retention period for the snapshot. You can choose to retain it permanently or specify a custom number of days.

    • Retain permanently: After the snapshot quota is reached, you cannot create new snapshots.

    • Custom retention period: The snapshot is automatically deleted after the specified retention period ends.

    Note
    • For information about the quota for manual snapshots, see Snapshot overview.

    • If you specify a custom retention period, the Retention Period column in the snapshot list displays the Released After xx Days message in highlighted text when only three days are left before the snapshot expires. You can extend the retention period before the snapshot expires. For more information, see Extend the retention period of a snapshot.

    • Regardless of whether a snapshot is retained permanently or for a custom period, delete the snapshot when it is no longer needed to avoid incurring charges. For more information, see Delete a snapshot.

    Advanced Configurations

    Instant Access

    The Instant Access feature is enabled by default for ESSD series disks (ESSD, ESSD AutoPL, ESSD Entry, and regional ESSD) and disabled by default for other types of cloud disks.

    Note

    The Instant Access feature makes snapshots available within seconds of being created. You can use a snapshot immediately for operations such as rolling back a cloud disk, creating a new cloud disk, or sharing the snapshot, without having to wait for the snapshot to be fully uploaded to OSS. For more information, see Snapshot Instant Access.

    Tags

    Add key-value tags to the snapshot to help manage your resources.

    Resource Group

    Assign the snapshot to a resource group to manage your resources by category.

  5. (Optional) View the snapshot creation progress on the Disk Snapshots tab.

    • In the Progress column, view the upload progress to OSS. Hover over Progress of Upload to OSS: xx% to see the estimated remaining time.

      Note
      • The estimated remaining time varies dynamically. See the Considerations section of the "Create a snapshot" topic.

      • To cancel an ongoing snapshot creation, call the DeleteSnapshot operation.

    • If Progress of Upload to OSS: 100% is displayed, the snapshot upload is complete and the disk data is backed up.

  6. Click the spot instance ID. In the upper-right corner, click All Actions, then search for and click Create Custom Image.

  7. In the Create Custom Image dialog box, configure the parameters and click OK.

    Image creation time varies based on disk size. Wait until the snapshot of each disk is created before using the image.

Note

You can also create a snapshot by calling the CreateSnapshot operation and create a custom image by calling the CreateImage operation.

Restore data

Procedure

  1. Go to the ECS console - images page.

  2. In the upper-left corner of the page, select a region and resource group.

  3. Find the image and click Create Instance in the Actions column.

  4. On the Custom Launch tab, click Custom Images in the Images section. Verify that the custom image from the previous step is selected. For other parameters, see Create an instance with Custom Launch.

Note

You can also call the RunInstances operation with ImageId specified to create an instance from a custom image.