Question 7: You are working in a news provider company, which has their online newspaper called AcmeNews.com. This website is currently running on 4 EC2 instances which are part of auto-scaling group and running behind the ELB. However, you have seen this instances does not have enough RAM and you want to change , instance type with the larger instance type which can provide more RAM, bandwidth and even you want to use EBS optimized instances. What you can do to replace the already running instances in auto-scaling group?
- You will modify the CloudFormation template and launch new instances using that CloudFormation.
- You will be configuring Elastic Beanstalk to launch new instance.
- You simply set the auto-scaling group size to 4 and launch new 5th instance in auto scaling group as per your need. And auto-scaling will terminate oldest instance.
- You will change the launch configuration of Auto-scaling group. And launch new instance using newer launch configuration and terminate the older instance.
Detailed Explaination: In summary question wanted to know that how will you replace an instance which is already running as part of Auto-scaling group.
Whenever auto-scaling launch new instance, it will be using launch configuration and using that launch configuration new instance will be launched. Hence, if you want to launch a bigger instance in a auto-scaling group then you have to attach a new launch configuration with the Auto-scaling group by replacing the older one. Once this change is made, launch new instance using newer launch configuration and terminate older instance. Hence, option-4 is the correct answer.
- Launch configuration has detail about AMI, instance type, key pair, security groups and block device mapping.
- So while launching new instance in Auto-scaling can use this configuration.
- Once launch configuration is created it cannot be modified.
- You can use same launch configuration for multiple auto-scaling group. But an auto-scaling group can have only one launch configuration.
- While creating launch configuration you have to provide either launch configuration, launch template or EC2 instance.