AWS Certified DevOps Engineer – Professional (DOP-C02) — Question 40

A developer is maintaining a fleet of 50 Amazon EC2 Linux servers. The servers are part of an Amazon EC2 Auto Scaling group, and also use Elastic Load Balancing for load balancing.
Occasionally, some application servers are being terminated after failing ELB HTTP health checks. The developer would like to perform a root cause analysis on the issue, but before being able to access application logs, the server is terminated.
How can log collection be automated?

Answer options

Correct answer: D

Explanation

The correct answer is D because it effectively utilizes Auto Scaling lifecycle hooks to pause the termination process, allowing for log collection through an AWS Lambda function triggered by an EventBridge rule. Options A, B, and C do not use the appropriate combination of lifecycle hooks and event triggers to ensure logs are collected before the instance is fully terminated.