All Products
Search
Document Center

Elastic Compute Service:Overview

Last Updated:Jan 30, 2024

Preemptible instances, formerly known as spot instances, are a type of on-demand instance that are offered at a lower 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 characteristics of preemptible instances.

Characteristic

Description

Bidding mode

The spot price (market price) of a preemptible instance fluctuates based on changes in supply and demand of the instance type. When you create a preemptible instance, you must use one of the following bidding modes to bid for an instance type.

  • Mode 1: Set Maximum Price (SpotWithPriceLimit)

    • If your bid is greater than or equal to the spot price and the instance type is well-stocked, the preemptible instance can be created and billed at the spot price.

    • If your bid is less than the spot price or the instance type is understocked, 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. The bid price can be up to the pay-as-you-go price. If the instance type is understocked, the preemptible instance is automatically released.

Note

After a preemptible instance is created, the instance 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 and elastic IP addresses (EIPs).

Protection period

By default, each preemptible instance is created with a protection period of 1 hour. You can configure a preemptible instance not to have a protection period when you create the instance.

  • During the protection period of a preemptible instance, the instance is not automatically released 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.

Recycling

After the protection period ends, the system checks the spot price and the stock level 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, the data of the instance cannot be recovered. We recommend that you create snapshots for the instance to back up 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 relationship. A lower release rate indicates that preemptible instances are less likely to be recycled.

In this example, ecs.c5.8xlarge instances that reside in Silicon Valley Zone B are used.

  • In the example, the pay-as-you-go price of the ecs.c5.8xlarge instance type is USD 1.52 per hour.

  • Preemptible ecs.c5.8xlarge instances that have a protection period of 1 hour cost 90% less than pay-as-you-go instances. The preemptible instance price of the ecs.c5.8xlarge instance type is USD 0.152 per hour.

If no protection period is specified when the preemptible ecs.c5.8xlarge instances are created, the price of the instances is 10% less than the price of identical preemptible instances that have a protection period. The final price of the instances is USD 0.137 per hour, which is calculated by using the following formula: 0.152 × 0.9.

Note

The 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 anytime. When the spot price exceeds your bid price or when the stock of the instance type is insufficient, the preemptible instance enters the To Be Released state and is automatically released in five minutes. You can check whether a preemptible instance is in the To Be Released state based on the instance metadata or the OperationLocks array in the response returned by the DescribeInstances operation.

You can store a small amount of data from a preemptible instance when the instance is in the To Be Released state and pending release. To make sure that an application runs as expected after your preemptible instance is released, we recommend that you optimize the application. You can manually release your preemptible instance to check whether the application runs as expected after the 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 applications, such as scalable web services, image rendering, big data analytics, and large-scale parallel computing. Preemptible instances are suitable for applications that require wide distribution, high scalability, and high fault tolerance. Preemptible instances help reduce your costs and increase the throughput for these applications.

Preemptible instances are suitable for the following scenarios:

  • Real-time analytics

  • Big data

  • Geological surveys

  • Image and media coding

  • Scientific computing

  • Scalable websites and web crawlers

  • Testing

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 cannot be stored.

Pricing and billing

  • Pricing

    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 rules 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 of 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 the protection period ends, 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 method

    Preemptible instances are billed in 1-second increments. 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 a preemptible instance by calling the StopInstance operation or by using the ECS console, billing for the instance continues. 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 anytime.

References

FAQ

  • To what resources are the discounts for preemptible instances applicable?

    The discounts for 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 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 preemptible instances with a protection period to preemptible instances without a protection period or convert preemptible instances without a protection period to preemptible instances with 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 relationship. release-rate

For more frequently asked questions about preemptible instances, see Instance FAQ.