An application runs on EC2 instances in an Auto Scaling group behind an Application Load Balancer. Instance logs are copied to a central S3 bucket every 15 minutes. The security team found that logs from some terminated instances are missing. Which set of steps will ensure logs from terminating EC2 instances are copied to the central S3 bucket before those instances are terminated?
Choose an answer
Tap an option to check your answer.
Correct answer: Create an AWS Systems Manager document that contains a script to copy logs to S3. Create an Auto Scaling lifecycle hook and an EventBridge rule to detect Auto Scaling lifecycle events. On autoscaling:EC2_INSTANCE_TERMINATING, invoke a Lambda function that calls the Systems Manager SendCommand API to run the document to copy logs, then send CONTINUE to the Auto Scaling group so termination proceeds..
Why this is the answer
The correct option uses an Auto Scaling lifecycle hook to pause instance termination, allowing a Lambda function to trigger an AWS Systems Manager (SSM) document via SendCommand to copy logs to S3. Sending CONTINUE to the Auto Scaling group then allows the instance to terminate. This ensures logs are captured before termination. The first incorrect option is flawed because sending ABANDON prevents termination, requiring manual intervention or a separate mechanism to terminate the instance, which is not scalable or automated. The third incorrect option's approach of changing the log interval is reactive and doesn't guarantee logs from the final moments of termination. Running user data scripts via CLI on a terminating instance is unreliable as the instance may already be shutting down. The fourth incorrect option incorrectly suggests sending ABANDON to terminate the instance, which is contradictory; ABANDON prevents termination.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed