我可以像停止和启动按需 ec2 实例一样在 aws 中停止 spot 实例吗

Can I stop a spot instance in aws just like I can stop and start an on demand ec2 instance

我有一个用例,在该用例中,我切换到为我的应用程序使用 spot 实例而不是按需实例。根据我的要求,我应该能够停止该实例并重新启动它,就像我们为按需 ec2 实例所做的那样。在 aws 控制台中,我只找到了重启或终止我的实例的选项,并将鼠标悬停在停止选项上说 "Spot instance cannot be stopped"。是否有允许停止实例的解决方法,或者目前无法停止?

[原文:2018 年 9 月]

自己无法停止竞价实例。

但是,您可以指定 spot 实例的中断行为是 "stop"(而不是 "terminate")。当中断事件发生时,您的实例将被关闭并保存其状态。当容量下一次满足您的 price/time 要求时,AWS 将重启您的实例。

此功能适用于持久性 Spot 请求和启用了“维护”队列选项的 Spot 队列。当您的实例停止时,您无需支付实例使用费。

[更新时间:2020 年 2 月]

根据 announcement on Jan 13, 2020:

You can now stop your Amazon EC2 Spot Instances backed by Amazon EBS and start them at will, instead of relying on the “Stop” interruption behavior to stop your Spot Instances when interrupted. Earlier, you could only terminate your Spot Instances but now you can stop your Spot Instances and start them from the user initiated stop state provided Spot capacity is available within your maximum price requirements.

您不能 STOP/START Spot 实例类似于 On-demand。下面 Link 有足够的信息。,

"You can't stop and start an Amazon EBS-backed instance if it is a Spot Instance (only the Spot service can stop and start a Spot Instance), but you can reboot or terminate a Spot Instance)"

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/how-spot-instances-work.html

自 2020 年 1 月 13 日起,您现在可以执行以下操作:https://aws.amazon.com/about-aws/whats-new/2020/01/amazon-ec2-spot-instances-stopped-started-similar-to-on-demand-instances/