This topic describes how to create a preemptible instance in the ECS console.

Background information

To create and use a preemptible instance, take note of the following items:
  • Set an appropriate bid which is comparable to but higher than the fluctuating market price. This way, your preemption request can be accepted and processed, and the created preemptible instance will not be released due to a low bid. The bid must also meet your business expectations.
  • Use an image that contains the configurations of all the required software. This can ensure the instance can be started any time after it is created. You can also use user data of the instance to run commands at instance startup. For more information, see User data.
  • Save important data in storage media that are not affected when preemptible instances are released, such as separately created cloud disks, OSS buckets, or ApsaraDB for RDS instances. This can prevent data loss caused by instance release.
  • Break down your jobs into small tasks by using grids, Hadoop, queue-based architecture, or use checkpoints to save calculation results.
  • Monitor the status of a preemptible instance by checking the instance release notifications from ECS. ECS updates the instance metadata five minutes before ECS releases a preemptible instance. You can obtain the status of a preemptible instance every minute by checking instance metadata. For more information, see Metadata.
  • Run your applications on a pay-as-you-go instance and release the instance to verify whether your applications can automatically adjust themselves in response to the release of preemptible instances.
You can use developer tools such as Alibaba Cloud CLI, OpenAPI Explorer, and Alibaba Cloud SDK to call the RunInstances operation and create a preemptible instance.
Note You can set the SpotStrategy parameter to SpotAsPriceGo to use the actual market price. Alternatively, you can set the SpotStrategy parameter to SpotWithPriceLimit to use the acceptable maximum price.

Procedure

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Instances & Images > Instances.
  3. On the Instances page, click Create Instance.
  4. Set Billing Method to Preemptible Instance.
  5. In the Maximum Price for Instance Type section, specify your bid in the spin box.
    The preemptible instance you request is created at the market price only if your bid is higher than or equal to the market price and resources are sufficient. You can bid for a preemptible instance only once. The following bidding modes are supported:
    • Use Automatic Bid: The real-time market price is used as the bidding price.
    • Set Maximum Price: You must set the highest price you are willing to pay for the instance type.
      Note In the displayed price range, the maximum price is equal to the price for the pay-as-you-go instance of the same instance type. Your bid must be based on the displayed price range, your business needs, and the estimated future price fluctuation. If you take into account the estimated future price fluctuation, you can continue to hold the instance even after the one-hour guaranteed duration expires. Otherwise, after the guaranteed duration expires, your instance may be automatically released.
  6. Select or enter the quantity of instances you want to purchase.
  7. Complete other settings.
    For more information about other parameters, see Create an instance by using the provided wizard.
  8. Preview the configurations you selected, and then click Create Instance.

Result

After a preemptible instance is created, you can view its information in the instance list. A preemptible instance is marked as a Pay-As-You-Go Preemptible Instance in the Billing Method column. Click the instance ID or instance name to go to the Instance Details page. You can view the bidding policy configured during instance creation in the Payment Information section.