amazon ec2 - How to replace ECS cluster instances without downtime or reduced redundancy? -
i have try-out environment ~16 services divided on 4 micro-instances. instances managed autoscaling group (asg). when need update ami of cluster instances, do:
- create new launch config, edit asg new launch config.
- detach instances replacement option asg , wait until new ones listed in cluster instance list.
- manually find , deregister old instances ecs cluster (very tricky)
- now services killed ecs due deregistering instances :(
- wait 3 minutes until services restarted on new instances
- manually find ec2 instances in ec2 instance list , terminate them (be very careful not terminate new ones).
with approach have 3 minutes of downtime , shiver idea in production envs.. there way without downtime keeping overall amount of instance same (so without 200% scaling settings etc.).
you can update launch configuration new ami , assign asg. make sure include following in user-data section:
echo ecs_cluster=your_cluster_name >> /etc/ecs/ecs.config
then terminate 1 instance @ time, , wait until new 1 , automatically registered before terminating next.
this scriptable automated too.
Comments
Post a Comment