Preemptible instances are a type of on-demand instances that are offered at a discounted price compared to pay-as-you-go instances. Preemptible instances are designed to minimize Elastic Compute Service (ECS) instance costs in specific scenarios.

Introduction

The following table describes the features of preemptible instances.
FeatureDescription
Bidding modeThe spot price (market price) of a preemptible instance fluctuates based on changes in supply and demand for the instance type. When you create a preemptible instance, you must specify one of the following bidding modes.
  • Mode 1: Set Maximum Price (SpotWithPriceLimit)
    • If your bid is greater than or equal to the spot price and the resources of the instance type are sufficient, the preemptible instance can be created and billed at the spot price.
    • If your bid is less than the spot price and the resources of the instance type are insufficient, the preemptible instance is automatically released.
  • Mode 2: Use Automatic Bid (SpotAsPriceGo)

    In this mode, the spot price is automatically used as the bid price and the preemptible instance is billed based on the spot price. The maximum price can be up to the pay-as-you-go price. If the resources of the instance type are insufficient, the preemptible instance is automatically released.

Note After a preemptible instance is created, it can be used in the same manner as a pay-as-you-go instance. You can also use the preemptible instance together with other cloud resources such as disks or elastic IP addresses (EIPs).
Protection periodBy default, each preemptible instance is created with a protection period of 1 hour. You can also configure a preemptible instance to not have a protection period when you create the instance.
  • During the protection period of a preemptible instance, the preemptible instance is not released by the system regardless of the fluctuations in the spot price. You can continue to perform operations on the preemptible instance.
  • Preemptible instances without a protection period are more cost-effective than preemptible instances with a protection period.
RecyclingAfter the protection period ends, the system checks the spot price and resource stock of the instance type every 5 minutes. If the spot price is higher than your bid price or if the stock of the instance type is insufficient, the preemptible instance is released.
Important After an instance is released, its data is lost and cannot be recovered. We recommend that you create snapshots for the instance to back up instance data before the instance is released. For more information, see Snapshot overview.

You can check the release rate of each instance type on the instance buy page in the ECS console regardless of whether you attempt to create preemptible instances with or without a protection period. The release rate of each instance type is determined by the bidding policy and the supply-demand relationships of resources. A lower release rate indicates that preemptible instances are less likely to be recycled.

In this example, the instance type of the following instances is ecs.c5.8xlarge and the instances reside in Silicon Valley Zone B:
  • The price of a pay-as-you-go instance is USD 1.52/hour.
  • A preemptible instance that has a protection period of 1 hour provides a discount of 90% off compared with a pay-as-you-go instance of the same type. The price of the preemptible instance is USD 0.152/hour.
If no protection period is specified when the preemptible instance is created, the price of the instance is discounted an additional 10%. The final price of the instance is 0.152 × 0.9 = USD 0.137 per hour.
Note The original pay-as-you-go price and the discount for preemptible instances are subject to changes. Prices in this example are for reference only.
spot-price-example-intl

Lifecycle

The following figure shows the lifecycle of a preemptible instance that has a protection period of 1 hour. 1

After a preemptible instance is created, you can release the instance at any time. When the spot price exceeds your bid price or when the stock of the instance type is insufficient, your instance enters the To Be Released state. After 5 minutes, the instance is automatically released. You can check whether the instance enters the To Be Released state based on the instance metadata or the OperationLocks value returned by the DescribeInstances operation.

You can check whether your preemptible instance enters the To Be Released state and store a small amount of data while you wait for the release of the instance. To make sure that the application runs normally after your preemptible instance is released, we recommend that you optimize the application design. You can manually release your preemptible instance to check whether the application runs normally after the preemptible instance is released.

In most cases, the system first releases the instance that has the lowest bid price. If multiple preemptible instances have the same bid price, the system randomly determines the order in which the instances are released.

Limits

  • The resource usage of your ECS instance determines whether you can create a preemptible instance. If the Preemptible Instance option is not available for the Billing Method parameter when you create an instance, you cannot create a preemptible instance.
  • Preemptible instances cannot be converted to subscription instances.
  • The instance types of preemptible instances cannot be changed.

Scenarios

Preemptible instances are ideal for stateless scenarios such as scalable web services, image rendering, big data analytics, and large-scale parallel computing. Preemptible instances can be applied to applications that require a high level of distribution, scalability, and fault tolerance capabilities. Preemptible instances help reduce costs and increase the throughput of these applications.

You can use preemptible instances in the following scenarios:
  • Real-time analytics
  • Big data
  • Geological surveys
  • Image and media coding
  • Scientific computing
  • Scalable websites and web crawlers
  • Tests

Preemptible instances are not suitable for stateful applications such as databases. When a preemptible instance is released due to a failed bid or other reasons, application status data cannot be stored.

Pricing and billing

  • Prices
    The price of a preemptible instance covers only the price of the instance type (including vCPUs and memory) and does not include the prices of resources such as the system disk, data disks, and network bandwidth.
    • System disks and data disks are billed on a pay-as-you-go basis. For more information, see Pay-as-you-go.
    • Network bandwidth is billed based on the billing rule for network usage of pay-as-you-go instances. For more information, see Public bandwidth.
  • Market prices

    The spot price of a preemptible instance fluctuates based on changes in supply and demand for the instance type. If your bid price is higher than the spot price at purchase and the stock of the instance type is sufficient, a preemptible instance can be created.

    If a protection period is specified for a preemptible instance, the instance is billed based on the spot price at the time of purchase. After 1 hour, the instance is billed based on the real-time market price.

    When you purchase preemptible instances, we recommend that you evaluate the fluctuations in the spot price to minimize computing costs and increase throughput.

  • Billing methods

    Preemptible instances are billed by second. The spot price of a preemptible instance is an hourly price. You can divide the hourly price by 3,600 to obtain the price per second.

    The fees for a preemptible instance from creation to release are accurate to two decimal places. Accrued fees of less than USD 0.01 are not charged.

  • Billing durations

    A preemptible instance is billed based on its usage duration, which starts from the time when the instance is created and ends at the time when the instance is released. If you stop an instance by calling the StopInstance operation or by using the ECS console, the instance continues to be billed. When a preemptible instance is no longer needed, we recommend that you create snapshots to back up your data and environment and then release the instance. You can purchase new preemptible instances at any time.

References

FAQ

  • To what resources are the prices of preemptible instances applicable?

    The prices of preemptible instances are applicable only to instance types. Other resources such as disks and network bandwidth are billed at the same prices as those of pay-as-you-go instances.

  • Am I notified when my preemptible instances are about to be released?

    Yes, you are notified when your preemptible instances are about to be released. When your preemptible instance needs to be released due to a spot price change or insufficient resources, the instance first enters the To Be Released state and is automatically released in 5 minutes.

  • Can the instance type of a preemptible instance be changed?

    No, the instance types of preemptible instances cannot be changed.

  • Which is more cost-effective: a preemptible instance with a protection period or a preemptible instance without a protection period?

    Preemptible instances without a protection period are more cost-effective than preemptible instances with a protection period.

  • Can I convert between preemptible instances with and without a protection period?

    No, you cannot convert between preemptible instances with and without a protection period. By default, each preemptible instance is created with a protection period of 1 hour. You can configure a protection period for preemptible instances only when you create them. The protection period settings of preemptible instances cannot be changed after the instances are created.

  • Is the release rate of preemptible instances without a protection period higher than that of preemptible instances with a protection period?
    You can check the release rate of each instance type on the instance buy page in the ECS console regardless of whether you attempt to create preemptible instances with or without a protection period. For each instance type, the release rate is determined by the bidding policy and the supply-demand relationships of resources. release-rate

For more information about preemptible instances, see Instance FAQ.