Questio-2: You have a very critical web application and it is required to be run 24X7 without interruption. Now you find that there is a small bug in your application as well as a security patch needs to be applied on all the EC2 instances which are part of Auto-Scaling group. There are 10 EC2 instances running in auto-scaling group. Entire deployment is managed using CloudFormation, now you need to perform these two updates on all the EC2 instances in auto-scaling group which of the given option will help in implementing correct solution?
- You will manually shutdown EC2 instances one by one and then apply changes and start EC2 instance again.
- You will be using Rolling Update strategy
- You will be deleting first 5 EC2 instance manually and then start another 5 instance with the required updates. And once all 5 started, you will be doing same thing will remaining 5 old instances.
- You will create another Auto-Scaling group and place both the Auto-Scaling group behind ELB and after some time you will stop old auto-scaling group.
Correct Answer : B
Detailed Explaination: In summary, you wanted to apply the patches already running EC2 instances which are part of Auto-scaling group. And even you have been informed that deployment is done using CloudFormation, which works as a hint.
As we mentioned many times, generally manual activities are not good and should be avoided. In this case we know, we can use CloudFormation then use the Rolling update policy.
Auto Scaling and Rolling update using CloudFormation:
- If you have an EC2 instance auto-scaling group, and want to update all the EC2 instances then manual process is not a good choice.
- You can create a new version of EC2 instance and then deploy those instances this is an immutable approach.
- If you want to apply security patch to all the EC2 instances OS or upgrading the application running on EC2 instances. You can use CloudFormation for that.
- CloudFormation supports the UpdatePolicy attribute for auto scaling groups and by specifying rolling update it can rollout all the updates in batches.
- But remember you have proper settings for that otherwise it can lead to unexpected behavior.