Preventing Errors in Auto Scaling Group Deployment with AWS

How to Prevent Errors in Auto Scaling Group Deployment

Prev Question Next Question

Question

Your application has an Auto Scaling group of three EC2 instances behind an Elastic Load Balancer.

Your Auto Scaling group was updated with a new launch configuration that refers to an updated AMI.

During the deployment, customers complained that they were receiving several errors even though all instances passed the ELB health checks.

How can you prevent this from happening again?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - B.

An Auto Scaling group is associated with one launch configuration at a time, and you can't modify a launch configuration after you've created it.

To change the launch configuration for an Auto Scaling group, you can use an existing launch configuration as the basis for a new launch configuration and then update the Auto Scaling group to use the new launch configuration.

After you change the launch configuration for an Auto Scaling group, any new instances are launched using the new configuration options, but existing instances are not affected.

Then to ensure the new instances are launches , change the size of the Autoscaling Group to 6 and once the new instances are launched, change it back to 3.

For more information on instances scale-in process and Auto Scaling Group's termination policies please view the following link:

https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-termination.html#default-termination-policy

For more information on changing the launch configuration please see the below link:

http://docs.aws.amazon.com/autoscaling/latest/userguide/change-launch-config.html

The problem in this scenario is that customers are experiencing errors even though all instances in the Auto Scaling group are passing the Elastic Load Balancer health checks. This indicates that the issue is not related to the health of the instances but rather to the application or configuration itself.

To prevent this from happening again, there are several potential solutions:

A. Create a new ELB and attach the Autoscaling Group to the ELB This option involves creating a new Elastic Load Balancer and attaching the Auto Scaling group to it. This can help to ensure that customers are directed only to healthy instances in the Auto Scaling group. However, this approach requires additional configuration and may result in downtime during the switch-over.

B. Create a new launch configuration with the updated AMI and associate it with the AutoScaling group. Increase the size of the group to six and when instances become healthy revert to three. This option involves creating a new launch configuration with the updated AMI and associating it with the existing Auto Scaling group. The size of the Auto Scaling group is increased to six, allowing the new instances to be added while the old ones are still running. Once the new instances are healthy, the size of the Auto Scaling group can be reverted to three. This approach can help to ensure that customers are directed only to healthy instances in the Auto Scaling group without causing downtime.

C. Manually terminate the instances with the older launch configuration. This option involves manually terminating the instances with the older launch configuration. This can help to ensure that customers are directed only to healthy instances in the Auto Scaling group. However, this approach requires manual intervention and may result in downtime during the termination process.

D. Update the launch configuration instead of updating the Autoscaling Group. This option involves updating the launch configuration directly instead of updating the Auto Scaling group. This can help to ensure that new instances launched by the Auto Scaling group use the updated launch configuration. However, this approach does not address the issue of customers receiving errors from the application or configuration.

In conclusion, the best solution for preventing this issue from happening again depends on the specific circumstances of the application and its environment. However, options B and D are generally preferable since they allow for seamless updates without causing downtime or requiring manual intervention.