gpt4 book ai didi

amazon-web-services - 使用 Cloudformation 和 Spot 实例执行 RollingUpdate

转载 作者:行者123 更新时间:2023-12-01 23:40:21 24 4
gpt4 key购买 nike

我正在使用cloudformation UpdatePolicy属性来执行滚动更新,以防我的 ec2 启动配置发生任何更改。这在使用按需实例时效果很好。但是当我使用 Spot 实例时,我收到以下错误:

Autoscaling rolling updates cannot be performed because the current launch configuration is using spot instances and MinInstancesInService is greater than zero.

MinInstancesInService 属性设置为零使其可以正常工作,但随后我会遇到大约 3-5 分钟的停机时间。

有没有办法使用 Cloudformation 在不停机的情况下实现这一目标?如果没有,有人可以指出一种更好的方法来自动化此滚动更新过程,因为我有多个环境,并且手动执行此操作非常容易出错。谢谢

最佳答案

使用竞价实例时,不能将 MinInstancesInService 设置为 0 以外的任何值,因为竞价实例可以随时终止,从而使 AWS 无法保证保留的最小实例数在滚动更新期间投入使用。

但是,您可以设置 MaxBatchSize将 UpdatePolicy 中的参数设置为 1,因此一次只会更新一个实例。为了确保高可用性,您必须确保您的 AutoScalingGroup 中有 2 个或更多实例可用,否则滚动更新将终止您的单个实例,从而导致停机。

关于amazon-web-services - 使用 Cloudformation 和 Spot 实例执行 RollingUpdate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47931206/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com