All Products
Search
Document Center

Elastic Compute Service:What are preemptible instances

Last Updated:Jan 20, 2025

Preemptible instances, previously known as spot instances, utilize Alibaba Cloud's surplus capacity. They offer the same performance as regular ECS instances, with prices that vary in real-time based on market supply and demand. Preemptible instances can offer cost savings of up to 90% compared to pay-as-you-go instances. They are available when there is sufficient inventory and are automatically interrupted and released when inventory is low.

Scenarios

Preemptible instances are ideal for cost-effective computing resources in short-term, high fault-tolerant applications. They are an economical option for applications that can handle flexible runtimes or tolerate interruptions. Suitable use cases include stateless, fault-tolerant, and interruption-tolerant business scenarios, such as:

  • Real-time analytics

  • Big data

  • Geological surveys

  • Image and media coding

  • Scientific computing

  • Scalable websites and web crawlers

  • Testing

  • Other stateless business scenarios

Important

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

Run a process

When creating a preemptible instance, you need to bid for resources. If the bid ≥ market price and inventory is sufficient, you will successfully obtain and use the instance. For a period of time, you can use the instance stably. The stable usage duration of the instance depends on the instance usage duration you set. After the stable usage duration, if the bid < market price or inventory is insufficient, automatic interruption and release are triggered, and the instance will be released 5 minutes later.

Note

Bidding: This pertains to the maximum price per instance that you establish in bidding mode, which represents the highest price you're prepared to pay for a chosen preemptible instance (this is not the actual billing price). You can select from two bidding options:

  • Use automatic bidding: The bid is set to equal the market price. Throughout the usage period, the instance's price will vary in real-time alongside the market price. This approach ensures that the instance remains uninterrupted by price changes, although it does not protect against interruptions or releases due to inventory shortages.

  • Establish a maximum price per instance: Your bid represents the maximum price you're willing to pay per instance. A higher bid increases your chances of retaining a preemptible instance. However, if your bid falls below the market price or there is insufficient inventory, your instance may be interrupted and released.

Detection mechanism: The system continuously compares your bid to the market price and assesses resource availability to decide whether to maintain or release the instance.

Duration of Instance Usage

  • Set a usage duration of 1 hour: Alibaba Cloud guarantees that your instance will remain uninterrupted and retained for at least one hour following its creation, ensuring it is exempt from the detection mechanism during this initial period.

  • No specified usage duration: The instance does not come with a guaranteed usage period. Upon creation, it is subject to a detection mechanism and may be interrupted and reclaimed without notice.

Automatic interruption and release

The automatic termination and release of preemptible instances are unavoidable. You can configure the instance usage duration and maximum price per instance according to your business needs to optimize costs and ensure sustained operation. Additionally, you can select various instance interruption modes to manage recovery or processing of the instance.

Instance interruption modes

  • Direct release: Upon automatic interruption and release, your instance, along with its computing resources (vCPU, GPU, and memory), static public IP, allocated bandwidth, and disks (system disk and data disk), will be immediately released.

  • Stopped mode: In stopped mode, triggered by automatic interruption and release, the instance ceases operations. It relinquishes computing resources such as vCPU, GPU, and memory, along with the static public IP and allocated bandwidth. However, resources like disks (system and data), Elastic IP Address (EIP), and snapshots are retained and will continue to incur charges. Once in stopped mode, there's a possibility that the instance cannot be restarted if there's a shortage of resources or if bid prices are exceeded due to market fluctuations.

When the instance interruption mode is configured as stopped mode, it is distinct from the stopped mode applied during the process of stopping an instance.

  • When you stop an instance, setting it to stopped mode proactively changes its running state before it is automatically interrupted and released (proactive trigger).

  • When the instance is configured to enter stopped mode upon interruption, Alibaba Cloud changes the instance's status upon automatic interruption and release (passive trigger).

  • If the instance interruption mode is set to direct release when creating a preemptible instance, even if you select stopped mode when stopping the instance, your preemptible instance will still be interrupted and released. After release, whether the disks (system disk and data disk) are retained depends on whether you set the disks to be released with the instance when creating the preemptible instance.

Note

Instance interruption modes are fixed once the preemptible instance has been created and cannot be changed.

Handling automatic interruption and release

  • Query interruption events: Alibaba Cloud enables the querying of preemptible instance interruption events via the CloudMonitor SDK, metadata, and additional methods. You can also utilize the DescribeInstances API to verify if an instance is in a recycling state (LockReason: Recycling), which indicates whether automatic interruption and release have been initiated.

  • Simulating and Receiving Interruption Events: To enhance the management of automatic interruptions and releases of preemptible instances, you can simulate interruption events for testing purposes.

  • Data retention: Upon purchasing a new preemptible instance, you have the option to configure the instance interruption mode to stopped mode, or to ensure that disks (both system and data disks) are not released alongside the instance. This configuration allows data retention even after the instance is automatically interrupted and released.

    • Preemptible instances in stopped mode may not always restart successfully. If they restart successfully, data is immediately restored.

    • Disks (system disk and data disk) not released with the instance need to be reattached to a newly created instance.

    For additional details, see how to restore data after preemptible instances are released.

Market price fluctuations

Note

The following example uses the ecs.hfg5.8xlarge instance type in the China (Hangzhou) region. The discount rate of preemptible instances and the original price of pay-as-you-go instances may vary. Prices on the purchase page prevail. This example is for reference only.

  • Preemptible instances are discounted, with prices as low as 10% of the original price of pay-as-you-go instances and as high as the original price of pay-as-you-go instances.

  • Compared to preemptible instances with a usage duration of 1 hour, preemptible instances with no specified usage duration are more cost-effective, even after the first hour of creation.

  • The market price of preemptible instances fluctuates based on supply and demand.

  • In the same region, the market price of preemptible instances with the same instance type may vary across different zones.

image

Limits

  • The availability of preemptible instances depends on your cloud server usage. If the billing method cannot be selected as preemptible instances when creating ECS instances, it indicates that preemptible instances are not supported.

  • 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-related

Billing rules: For detailed information, please refer to preemptible instances.

Historical Prices: When creating preemptible instances, you can view the historical prices for instance types directly in the console. Additionally, the DescribeSpotPriceHistory API allows you to retrieve historical pricing data.

Billing queries: For details on viewing preemptible instance bills, see the referenced document.

Service integration

Auto Scaling: Automatically adjusts the number of instances to align with business demands and established policies. For additional details, see how to use preemptible instances in scaling groups for cost reduction.

Auto Provisioning Groups: Auto Provisioning Groups offer a streamlined solution for rapidly deploying clusters of ECS instances. With straightforward configuration, these groups can automatically deploy a mix of instances with different billing methods, such as pay-as-you-go and preemptible instances, across multiple zones. This enhances the efficiency of deploying large quantities of instances in batch operations. For more information, see an auto provisioning group configuration example.

Container Service for Kubernetes (ACK): Provides high-performance, scalable container application management services and supports the lifecycle management of enterprise-grade Kubernetes containerized applications. For more information, see the following documents:

FAQ

For additional details on preemptible instances, refer to the instance FAQ.