简体   繁体   English

AWS-重建Autoscale组中的所有实例

[英]AWS - Rebuild All Instances In Autoscale Group

We are looking for a way to trigger a rolling update or a reset of all instances in an autoscale group without changing the CloudFormation JSON or Launch Configuration user data. 我们正在寻找一种触发滚动扩展或重置自动伸缩组中所有实例的方法,而无需更改CloudFormation JSON或Launch Configuration用户数据。

The reason we are trying to do this is that we have multiple JBoss Application servers in our autoscale group. 我们尝试执行此操作的原因是,我们的自动伸缩组中有多个JBoss Application服务器。 To keep these servers fairly stateless we have the deployable wars on the S3 and whenever a new server gets spun up its grabs the wars and then deploys them. 为了使这些服务器保持无状态,我们在S3上部署了战争,每当新服务器启动时,它就会抢夺战争并进行部署。 Sometimes there is an update to the war files that we need to have deployed to the instances in the group. 有时需要更新战争文件,我们需要将其部署到组中的实例上。 Since these servers always grab the new files, we are hoping to have a way that AWS just deletes everything and then rebuilds. 由于这些服务器始终会捕获新文件,因此我们希望有一种方法,使AWS仅删除所有内容然后进行重建。 Really we need the same behavior as the autoscale update policies but in a way we can run them via CloudFormation or CLI without changing any JSON or user data. 确实,我们需要与自动缩放更新策略相同的行为,但是在某种程度上,我们可以通过CloudFormation或CLI运行它们,而无需更改任何JSON或用户数据。 Where we are putting our deployable files on the S3 there is no need to change AMI's or anything JSON or user data related. 在将可部署文件放在S3上的地方,无需更改AMI或与JSON或用户数据相关的任何内容。

Update Policies for the behavior we are looking for: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html 针对我们正在寻找的行为的更新策略: http : //docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html

To update your Auto Scaling fleet: 要更新您的Auto Scaling机队,请执行以下操作:

  • Set the Auto Scaling Termination Policy to OldestInstance . Auto Scaling终止策略设置OldestInstance
  • Launch new instances into the Auto Scaling group. 将新实例启动到Auto Scaling组中。 They will, as you have described, use your latest war files. 正如您所描述的,它们将使用最新的war文件。 This can be done by increasing the Desired quantity on the Auto Scaling group. 这可以通过增加Auto Scaling组上的Desired数量来完成。
  • Once the new instances have launched, decrease the Desired quantity back to the original level. 启动新实例后,请将Desired数量减少到原始级别。 This will cause instances to be terminated, starting with the oldest instances first. 这将导致实例终止,首先从最早的实例开始。

This is a neat way to roll-out updates to a fleet while maintaining accessibility to the application. 这是在保持对应用程序的可访问性的同时将更新发布到舰队的一种好方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM