AWS Certified Solutions Architect – Professional — Question 645

A company is running an application on several Amazon EC2 instances in an Auto Scaling group behind an Application Load Balancer. The load on the application varies throughout the day, and EC2 instances are scaled in and out on a regular basis. Log files from the EC2 instances are copied to a central
Amazon S3 bucket every 15 minutes. The security team discovers that log files are missing from some of the terminated EC2 instances.
Which set of actions will ensure that log files are copied to the central S3 bucket from the terminated EC2 instances?

Answer options

Correct answer: D

Explanation

Option D is correct because an Auto Scaling lifecycle hook pauses the instance termination process, allowing custom actions to be completed before the instance is fully shut down. By publishing a notification to Amazon SNS, the system can trigger AWS Systems Manager SendCommand to run the log-copying script on the instance, and then safely send an ABANDON signal to let the Auto Scaling group proceed with the termination. Other options either fail to correctly pause the lifecycle state or do not use the appropriate event flow to execute the script before termination occurs.