Deployment Strategies In AWS ASG - Launch before Terminating
We all know what is AWS ASG (Auto Scaling Group) which scales EC2 instances based on CloudWatch metrics. Backbone of ASG is Launch Template(LT), which acts like a blue print for creating EC2 instances.
Whenever, there is an update to the LT, existing instances must be updated safely without having much downtime or with near zero downtime.
ASG offers various methods of instance refresh.
3) Custom Behavior.
Launch and Terminate: As the name says, it creates new instance with latest LT before terminating existing instances. Launch new instances and wait for them to be ready
before terminating others. This allows you to go above your desired
capacity by a given percentage and may temporarily increase costs.
Let's say the ASG has desired capacity of 5 EC2 instance. "Launch before Terminating" strategy ensures it always has 5 EC2 instances exist.
With "Launch before Terminating":
At any given time, it can have max of 6 instances during the deployment.
Watch for the Launch template/configuration version.
If you watch closely, the "Max" is the parameter which we can change under this strategy. If I set it as 100%, then it can create +1 instance. Which means it creates 6th instance with new LT and terminates one of the old instance. Like wise, it can create only one instance at a time with new LT and terminates the old one. With "Max" 100% to increase the deployment time.
Comments
Post a Comment