0

Here is my LaunchConfiguration of my AutoScalingGroup in my ECS-Cluster - using cloudformation.

UpdatePolicy:
  AutoScalingRollingUpdate:
    MinInstancesInService: 1
    MaxBatchSize: 1
    PauseTime: PT15M
    WaitOnResourceSignals: true

My issue with the current setup is, when I make changes to the ECS Host AMI it will result in each of the EC2 instances being shut down and replaced one at a time. This results in any/all ECS Services currently running being terminated even before the the new EC2 instance is created.

Is there a way to do this? Their documentation says nothing about achieving the behavior we want.

Any pointers or tips are appreciated.

1 Answer 1

0

Set MinInstancesInService above equal to the ASG's current count before the update - that will make Cloudformation create a new instance before terminating the oldest one each time. Be sure to suspend process on the ASG while the update is happening or auto scaling can interfere with cloudformation's understanding of what instances need to be replaced. Also, use an autoscaling lifecycle hook heartbeat to pause the shutdown of your instances for 15mins or so and use a Lambda to intercept the termination and set the instance to DRAINING mode. See this blog article: https://aws.amazon.com/blogs/compute/how-to-automate-container-instance-draining-in-amazon-ecs/

1
  • okay, i need to read more of this.
    – gzz
    Sep 18, 2017 at 6:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .