简体   繁体   中英

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.

The reason we are trying to do this is that we have multiple JBoss Application servers in our autoscale group. 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. 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. 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. 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.

Update Policies for the behavior we are looking for: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html

To update your Auto Scaling fleet:

  • Set the Auto Scaling Termination Policy to OldestInstance .
  • Launch new instances into the Auto Scaling group. They will, as you have described, use your latest war files. This can be done by increasing the Desired quantity on the Auto Scaling group.
  • Once the new instances have launched, decrease the Desired quantity back to the original level. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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