All Products
Search
Document Center

Elastic Container Instance:Create a preemptible instance

Last Updated:Jun 20, 2026

Elastic Container Instance (ECI) supports preemptible instances. For short-running jobs and some stateless applications with high scalability and fault tolerance, you can use preemptible instances to effectively reduce instance costs. This topic describes how to create a preemptible elastic container instance.

Background information

A preemptible instance is a low-cost, bid-based computing resource. You can bid on idle resources on Alibaba Cloud to run your containers. These resources are reclaimed when your bid falls below the current market price or when the resource inventory is insufficient.

Preemptible instances are suitable for short-running jobs and highly scalable, fault-tolerant stateless applications, such as elastically scalable web services, image rendering, big data analytics, and large-scale parallel computing. The more distributed, scalable, and fault-tolerant your application is, the more you can save on costs and increase throughput by using preemptible instances. For more information, see What is a preemptible instance?.

Key concepts

Before you create a preemptible instance, understand the following concepts:

  • Billing method

    The market price of a preemptible instance fluctuates with supply and demand. When you create a preemptible instance, you must specify a bid policy. If your bid is higher than the real-time market price for the specified instance type and the inventory is sufficient, the instance is successfully created. After creation, the instance is billed at the market price at the time of purchase during its protection period (1 hour by default). After the protection period ends, the instance is billed at the real-time market price.

    Note

    Preemptible instances are offered at a discount compared to pay-as-you-go instances. The actual price fluctuates based on supply and demand, and you are charged for the actual usage duration. For more information, see Billing of preemptible instances.

  • Reclaim mechanism

    After the protection period ends, the system automatically checks the market price and inventory of the instance type every 5 minutes. If the market price at any time is higher than your bid or the inventory of the instance type is insufficient, the system releases the preemptible instance.

    Note
    • Approximately 3 minutes before the system reclaims the resources, it generates an event indicating that the instance is about to be released.

    • After the system reclaims the resources, billing for the instance stops. The instance information is retained, and its status changes to Expired.

Usage notes

When you use preemptible instances, note the following:

  • Choose an appropriate instance type and place a reasonable bid.

    You can call the OpenAPI operations of ECS to query information about preemptible instances over the last 30 days to help you select an instance type and place a bid. The relevant operations are:

    Important

    Set a bid that is high enough to account for market price fluctuations and aligns with your business cost expectations. This increases the chance of creating a preemptible instance successfully and prevents it from being released due to price changes, allowing you to meet business needs while saving costs.

  • Store your important data on storage media that are not affected by the release of preemptible instances, such as cloud disks (with the release with instance option disabled) or NAS.

Creation methods

You can create a preemptible elastic container instance by specifying an ECS instance type or by specifying vCPU and memory:

  • Specify an ECS instance type

    Billing is based on the pay-as-you-go market price of the specified instance type and the real-time discount.

  • Specify vCPU and memory

    This method has the same effect as specifying an ECS instance type. The system automatically matches an ECS instance type that meets the resource and price requirements. Billing is based on the market price of this matched instance type. In other words, the discount applies to the market price of the matched ECS instance type, not the pay-as-you-go price of the corresponding vCPU and memory.

    This method supports only specifications of 2 vCPUs or more. The following table lists the supported vCPU and memory specifications. If you specify an unsupported specification, the system automatically rounds it up to the next supported specification.

    vCPU

    Memory (GiB)

    2

    2, 4, 8, 16

    4

    4, 8, 16, 32

    8

    8, 16, 32, 64

    12

    12, 24, 48, 96

    16

    16, 32, 64, 128

    24

    24, 48, 96, 192

    32

    32, 64, 128, 256

    52

    96, 192, 384

    64

    128, 256, 512

Configurations

API

When you call the CreateContainerGroup operation to create an elastic container instance, you can use the SpotStrategy parameter to set the bid policy, the SpotPriceLimit parameter to set the maximum hourly price, and the SpotDuration parameter to set the protection period for the preemptible instance. The following table describes these parameters. For more information, see CreateContainerGroup.

Parameter

Type

Example

Description

SpotStrategy

string

SpotWithPriceLimit

The bid policy for the instance. Valid values:

  • NoSpot (default): a regular pay-as-you-go instance.

  • SpotWithPriceLimit: a preemptible instance with a user-defined maximum price.

  • SpotAsPriceGo: a preemptible instance where the system automatically bids based on the real-time market price.

    Important

    If you use the SpotAsPriceGo policy and resources for the specified instance type are scarce in the selected zone, the price can rise to the standard pay-as-you-go price.

SpotPriceLimit

number

0.2

The maximum hourly price for the preemptible instance. The value supports up to three decimal places. This parameter is required when you set the SpotStrategy parameter to SpotWithPriceLimit.

SpotDuration

long

1

The protection period of the preemptible instance, in hours. The default value is 1. You can set the value to 0 to specify no protection period.

Console

When you create a preemptible ECI instance in the Elastic Container Instance console, in the Basic Configurations section, set Billing Method to Spot Instance.

This method has the following limitations:

  • The bid policy cannot be set and defaults to SpotAsPriceGo, where the system automatically bids at the current market price.

  • The protection period cannot be set to zero and defaults to 1 hour.