All Products
Search
Document Center

Elastic Compute Service:Overview

Last Updated:Feb 21, 2025

Preemptible instances, formerly known as spot instances, are unused Elastic Compute Service (ECS) capacity and have the same performance as ECS instances of other pricing models. The prices of preemptible instances vary based on the supply and demand and can go as low as 10% of the prices of pay-as-you-go instances that have the same configurations. Preemptible instances can be created and used when the resource inventory is sufficient, and be interrupted and reclaimed when the resource inventory is insufficient.

Scenarios

Preemptible instances provide cost-effective computing resources for short-term tasks and highly fault-tolerant applications. If you are flexible about when your applications run and if your applications can be interrupted, preemptible instances are a cost-effective choice. Preemptible instances are suitable for business that runs in a stateless manner and is highly tolerant to faults and interruptions, such as:

  • Real-time analytics

  • Big data

  • Geological surveys

  • Image and media coding

  • Scientific computing

  • Scalable websites and web crawlers

  • Testing

  • Other stateless business

Important

Preemptible instances are not suitable for stateful, long-running, or high-stability business, such as database services or continuous operations.

Instance lifecycle

image

To create a preemptible instance, you must place a bid for an instance type. If the bid price is higher than or equal to the market price of the instance type and the resource inventory of the instance type is sufficient, the preemptible instance is created. If you set the Instance Usage Duration parameter, which specifies a protection period, to a value other than None when you create the preemptible instance, the created instance enters the specified protection period during which you can reliably use the instance. After the protection period ends, the interruption and reclamation of the preemptible instance are triggered if the market price exceeds your bid price or the resource inventory of the corresponding instance type is insufficient. Five minutes after the interruption and reclamation are triggered, the instance is released.

Note

Bid price: The bid price is determined by the Highest Price per Instance parameter configured when you create a preemptible instance. The bid price is the highest price that you are willing to pay for a preemptible instance of a specific instance type, not the price based on which you are actually charged for the instance. Valid values of the Highest Price per Instance parameter:

  • Use Automatic Bid: The market price is automatically used as the bid price for a preemptible instance of a specific instance type to ensure that the bid price is always equal to the market price and the instance is never interrupted or reclaimed due to fluctuations in the market price. However, the preemptible instance is still likely to be interrupted and reclaimed if the resource inventory is insufficient.

  • Set Maximum Price: You can specify a maximum price that you are willing to pay for a preemptible instance of a specific instance type. A higher bid price increases your chances of retaining a preemptible instance. If the bid price is lower than the market price or the resource inventory is insufficient, the preemptible instance is interrupted and reclaimed.

Check mechanism: The system continuously compares the bid price against the market price and checks the resource inventory to determine whether to retain or reclaim a preemptible instance.

Instance Usage Duration

  • One Hour: If you set the Instance Usage Duration parameter to One Hour when you create a preemptible instance, the instance enters a 1-hour protection period upon creation. During the protection period, the instance is exempt from the check mechanism and is not interrupted or reclaimed.

  • None: If you set the Instance Usage Duration parameter to None when you create a preemptible instance, the instance does not have a protection period. The preemptible instance is subject to the check mechanism and may be interrupted and reclaimed at any time.

Interruption and reclamation

Preemptible instances may be inevitably interrupted and reclaimed. You can configure the Instance Usage Duration and Highest Price per Instance parameters based on your business scenarios to balance instance costs and uptime. You can also configure the Instance Interruption Mode parameter to specify how to handle preemptible instances after the interruption and reclamation of the instances are triggered.

Instance Interruption Mode

  • Release: If you set the Instance Interruption Mode parameter to Release for a preemptible instance, the instance and the following resources are released when the interruption and reclamation of the instance are triggered: computing resources (vCPUs, GPUs, and memory), static public IP address (public IP address that is automatically assigned to the instance), public bandwidth, and cloud disks (system disk and data disks).

  • Stop in Economical Mode: If you set the Instance Interruption Mode parameter to Stop in Economical Mode for a preemptible instance, the instance is stopped in economical mode when the interruption and reclamation of the instance are triggered. After a preemptible instance is stopped in economical mode, the computing resources (vCPUs, GPUs, and memory), static public IP address, and public bandwidth associated with the static public IP address of the instance are reclaimed and no longer billed. The billing for other resources of the preemptible instance continues, such as the cloud disks (system disk and data disks), elastic IP addresses (if any), and snapshots. A preemptible instance that is stopped in economical mode may fail to be restarted due to insufficient resource inventory or fluctuations in the market price.

A preemptible instance is stopped differently if you set the Instance Interruption Mode parameter to Stop in Economical Mode from if you set the Stop Mode parameter to Economical Mode to stop the instance. For information about how to stop an instance, see Stop Instance.

  • If you set the Stop Mode parameter to Economical Mode when you stop a preemptible instance, you manually stop the instance in economical mode before the interruption and reclamation of the instance are triggered.

  • If you set the Instance Interruption Mode parameter to Stop in Economical Mode, Alibaba Cloud stops the preemptible instance in economical mode when the interruption and reclamation of the instance are triggered.

  • If you set the Instance Interruption Mode parameter to Release when you create a preemptible instance, the instance can still be interrupted and reclaimed even if you set the Stop Mode parameter to Economical Mode when you stop the instance. After a preemptible instance is released, the cloud disks (system disk and data disks) attached to the instance are retained or released based on whether you enabled the Release with Instance attribute for the disks when you created the instance.

Note

You cannot modify the Instance Interruption Mode parameter for a preemptible instance after the instance is created.

Handle the interruptions and reclamations of preemptible instances

  • Query preemptible instance interruption events. Alibaba Cloud allows you to use different methods, such as CloudMonitor SDKs and instance metadata, to query preemptible instance interruption events. You can also call the DescribeInstances operation to check whether a preemptible instance is in the To Be Released state and determine whether the instance is interrupted and due to be reclaimed. If Recycling is returned for the LockReason parameter in the response, the preemptible instance is in the To Be Released state, interrupted, and due to be reclaimed.

  • Retain data. When you purchase a preemptible instance, set the Instance Interruption Mode parameter to Stop in Economical Mode or disable the Release with Instance attribute for the cloud disks (system disk and data disks) attached to the instance. This way, the data of the preemptible instance is retained when the instance is interrupted and reclaimed.

    • A preemptible instance that is stopped in economical mode may fail to be restarted. If the preemptible instance is restarted, the data of the instance is immediately restored.

    • If the cloud disks (system disk and data disks) attached to a preemptible instance are retained when the instance is interrupted and reclaimed, you can attach the disks to a different instance to restore the data of the preemptible instance.

    For more information, see Restore data when a preemptible instance is reclaimed.

Fluctuations in market prices

Note

In the following example, a pay-as-you-go instance and a preemptible instance of the ecs.hfg5.8xlarge instance type that reside in the China (Hangzhou) region are used. The prices are only for reference.

  • Preemptible instances cost significantly less than pay-as-you-go instances. The prices of preemptible instances can go as low as 10% of pay-as-you-go prices and cannot exceed the pay-as-you-go prices.

  • A preemptible instance that does not have a protection period is more cost-effective than a preemptible instance that has a 1-hour protection period, even after the initial hour of operation.

image

  • The market prices of preemptible instances fluctuate based on the supply and demand.

  • The market prices of preemptible instances of the same instance type in the same region may differ if the instances reside in different zones.

image

Limits

  • Whether you can use preemptible instances is determined based on your ECS usage. If you cannot use preemptible instances, the Preemptible Instance option is unavailable when you create ECS instances.

  • Preemptible instances cannot be converted to subscription instances.

  • The instance types of preemptible instances cannot be changed.

  • Preemptible instances do not support Internet Content Provider (ICP) filing.

Billing

Billing rules: For information about the billing of preemptible instances, see Preemptible Instance.

Historical prices: When you create a preemptible instance in the ECS console, you can select an instance type to view the price history of the instance type. You can also call the DescribeSpotPriceHistory operation to query the price history of an instance type for a preemptible instance.

Bills: For information about how to view the bills for preemptible instances, see the Example: View the bills for preemptible ECS instances section of the "View billing details" topic.

Compatible services

Auto Scaling: Auto Scaling is a service that automatically changes the number of ECS instances to adjust the computing power based on business requirements and policies. For more information, see Use preemptible instances to reduce costs.

Auto Provisioning: Auto Provisioning allows you to quickly deliver ECS instance clusters. You need to only perform simple configurations to automate the delivery of instances that use different billing methods (pay-as-you-go and preemptible instances) across instance types and zones. This improves the efficiency of batch delivering a large number of instances. For more information, see Configure an auto provisioning group.

Container Service for Kubernetes (ACK): ACK provides high-performance containerized application management services to allow enterprises to manage the lifecycle of containerized applications and efficiently deploy containerized applications in the cloud. For more information, see the following topics:

FAQ

To obtain answers to frequently asked questions about preemptible instances, see Instance FAQ.