Cloud Formation - Updating Stack by Elbow Does Not Update AMI

We drive our AW2 EC2 instances using cloud education. We have 3 different stacks - testing, staging and production. Our workflow for updating images for any of the stacks is as follows:

  • Refresh Gold Master instance
  • Gold master picture on disk image
  • Change the ami link in our cloud education configuration (via json file) for this stack and update stack.

This results in fewer instances on the stack + re-provisioning them with a new disk image.

We had no problems with our test or intermediate stacks, which contain one instance of ec2 each. With each update, the image is replaced without problems.

Our production stack does not seem to work the same way :-( It contains (at least) 2 instances sitting behind the load balancer. When we update this stack in the same way, the ec2 instances do not (that is, after the update is completed, the boxes will still work from the previous disk image.) Good news - new images are used when the load balancer autoscales.

Could there be a conflict between load balancing rules and cloud formation?

Any insight would be appreciated.

+6
source share
2 answers

OK - Do some experimentation. You must define an update policy for the zoom group. By defining the update policy, any change to the launch configuration then triggers the update. Without this, the update will not start.

You do not need an ELB to run a rolling update, but if you have one, it will also not interfere with it.

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html

+7
source

Can we see your cloud formation script? You are probably right about elb + autoscaling.

To update ami (without cloud information), I double the value of the desired value of the autoscale group manually and set it as soon as new instances are online in ELB.

A similar tactic may be scriptable / cloud-based.

0
source

Source: https://habr.com/ru/post/950890/


All Articles