Spot instances disappear and the state reason is `Server.SpotInstanceTermination`.
IntermediateTroubleshootingEC2, Auto Scaling and Load Balancing
Answer
Likely causes → AWS reclaimed the Spot capacity. You get a 2-minute interruption notice, and possibly an earlier rebalance recommendation.
Diagnose →
aws ec2 describe-instances --instance-ids i-0abc --query 'Reservations[].Instances[].StateReason'
aws ec2 describe-spot-instance-requests --filters Name=instance-id,Values=i-0abc \
--query 'SpotInstanceRequests[].Status'
# on the instance, the notice endpoint:
curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/spot/instance-action
Fix →
- Diversify across many instance types and all AZs, and use the
price-capacity-optimizedallocation strategy - Handle the interruption notice: drain from the LB and checkpoint work. On EKS, use Karpenter or the Node Termination Handler
- Turn on Capacity Rebalancing on the ASG
Prevent → Run only stateless, interruptible workloads on Spot, and keep an On-Demand base capacity for the minimum.