AWS Certified Sysops Administrator Associate · Free Practice Question Medium
Question 47
An application runs on several Amazon EC2 instances behind an Application Load Balancer (ALB). The instances run in an Auto Scaling group that is configured to determine the health status of EC2 instances using both EC2 status checks and ALB health checks. An application fault has been detected and it is necessary to analyze unhealthy instances before they are terminated.
What should a SysOps Administrator do to accomplish this?
-
A
Create an AWS Lambda function that takes a snapshot of the instances before they are terminated.
-
B
Implement Amazon CloudWatch Events to capture lifecycle events and trigger an AWS Lambda function for remediation.
-
C
Use an Amazon EC2 Auto Scaling lifecycle hook to pause instance termination after the instance has been removed from service.
-
D
Configure the Auto Scaling group to only use ALB health checks so instances are taken out of service but are not terminated.
Reveal correct answer
Correct answer: C
Explanation
Lifecycle hooks enable you to perform custom actions by pausing instances as an Auto Scaling group launches or terminates them. When an instance is paused, it remains in a wait state either until you complete the lifecycle action using the complete-lifecycle-action command or the CompleteLifecycleAction operation, or until the timeout period ends (one hour by default).
For example, when a scale-in event occurs, the terminating instance is first deregistered from the load balancer. Then, a lifecycle hook pauses the instance before it is terminated. While the instance is in the wait state, you can, for example, connect to the instance and download logs or other data before the instance is fully terminated.
This is a good way to ensure that the instances are not terminated until the analysis has been completed.
CORRECT: "Use an Amazon EC2 Auto Scaling lifecycle hook to pause instance termination after the instance has been removed from service" is the correct answer.
INCORRECT: "Implement Amazon CloudWatch Events to capture lifecycle events and trigger an AWS Lambda function for remediation" is incorrect. The CloudWatch lifecycle events would only trigger upon instance termination, which is too late. In this case the trigger needs to be when the instance is taken out of service after failing a health check and for this lifecycle hooks should be used.
INCORRECT: "Configure the Auto Scaling group to only use ALB health checks so instances are taken out of service but are not terminated" is incorrect. You cannot configure an Auto Scaling group to use only ALB health checks, they are always in addition to the EC2 status checks.
INCORRECT: "Create an AWS Lambda function that takes a snapshot of the instances before they are terminated" is incorrect. The Lambda function would require a trigger and this must be when the instance is taken out of service after failing a health check, not when it is terminated. Therefore, there is no clear way to trigger the function at the correct stage for this scenario.
References:
https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html
Save time with our AWS cheat sheets:
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
