SpotInstanceTermination cloud runtime_error ai_generated partial

EC2竞价实例终止通知:您的竞价实例'i-1234567890abcdef0'已终止,因为竞价价格超过了您愿意支付的最高价格。

EC2 Spot Instance termination notice: Your Spot Instance 'i-1234567890abcdef0' is terminated because the Spot price exceeded the maximum price you are willing to pay.

ID: cloud/aws-ec2-spot-instance-termination

其他格式: JSON · Markdown 中文 · English
75%修复率
84%置信度
1证据数
2023-04-18首次发现

版本兼容性

版本状态引入弃用备注
EC2 Spot Instances (all regions) active
AWS CLI 2.13.0 active

根因分析

竞价实例的出价低于当前竞价市场价格,导致AWS回收该实例。

English

The Spot Instance's bid price is lower than the current Spot market price, causing AWS to reclaim the instance.

generic

官方文档

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-instances-termination-notices.html

解决方案

  1. Use a Spot Fleet or EC2 Fleet with multiple instance types and bid prices. Example: `aws ec2 request-spot-fleet --spot-fleet-request-config file://config.json` where config.json includes diverse instance types (e.g., m5.large, c5.large) and a max bid equal to the On-Demand price. This increases chances of capacity availability.
  2. Implement graceful shutdown handling. Use the EC2 metadata endpoint to check for termination notices (http://169.254.169.254/latest/meta-data/spot/termination-time) and save state before termination. Example script: `curl http://169.254.169.254/latest/meta-data/spot/termination-time 2>/dev/null && echo "Termination imminent"`

无效尝试

常见但无效的做法:

  1. Increase the bid price to the On-Demand price 60% 失败

    Setting bid to On-Demand price defeats the purpose of Spot Instances and may still not guarantee persistence during high demand. AWS may still terminate if capacity is reclaimed.

  2. Use a different instance type without changing bid 70% 失败

    Different instance types have different Spot markets; the same bid may still be too low for the new type.