What should you do in order to avoid errors for future deployments?
(Choose two.)
Add an Elastic Load Balancing health check to the Auto Scaling group. Set a short period for the health checks to operate as soon as possible in order to prevent premature registration of the instance to the load balancer.
Enable EC2 instance CloudWatch alerts to change the launch configuration’s AMI to the previous one. Gradually terminate instances that are using the new AMI.
Set the Elastic Load Balancing health check configuration to target a part of the application that fully tests application health and returns an error if the tests fail.
Create a new launch configuration that refers to the new AMI, and associate it with the group. Double the size of the group, wait for the new instances to become healthy, and reduce back to the original size. If new instances do not become healthy, associate the previous launch configuration.
Increase the Elastic Load Balancing Unhealthy Threshold to a higher value to prevent an unhealthy instance from going into service behind the load balancer.
Explanations:
Adding a health check to the Auto Scaling group that operates quickly may cause premature registration of instances that are not fully ready, leading to errors. ELB health checks are already in place and designed to ensure only healthy instances are registered.
Enabling CloudWatch alerts to revert to the previous AMI after deployment does not proactively address the issue. It only reacts to problems after they occur, and it might cause further downtime during the rollback.
Setting the ELB health check configuration to target a specific part of the application allows for a more thorough health check, ensuring that instances are only registered when they can handle traffic properly, thus reducing errors.
Creating a new launch configuration and scaling up allows for a controlled rollout of new instances. If new instances are unhealthy, rolling back to the previous configuration ensures that the system maintains availability without impacting users.
Increasing the Unhealthy Threshold may delay the detection of truly unhealthy instances, leading to longer exposure to errors for users. It is more beneficial to detect issues promptly and react accordingly.