A DevOps engineer manages an Amazon ECS cluster running on EC2 instances in an Auto Scaling group. The engineer must capture and review all stopped tasks to investigate errors. Which approach satisfies this requirement?
Choose an answer
Tap an option to check your answer.
Correct answer: Create an Amazon EventBridge rule to capture task state-change events, send those events to Amazon CloudWatch Logs, and use CloudWatch Logs Insights to analyze stopped tasks..
Why this is the answer
The correct approach leverages EventBridge to capture ECS task state-change events, specifically when tasks stop. EventBridge can then forward these events to CloudWatch Logs, creating a centralized log stream of stopped tasks. CloudWatch Logs Insights provides a powerful query language to analyze these logs, allowing the engineer to filter, aggregate, and investigate errors associated with stopped tasks efficiently. Incorrect options: Emitting logs in Embedded Metric Format is for metrics, not for capturing and analyzing task state changes directly. Monitoring ContainerInstanceCount tracks instance changes, not individual task stoppages. Forwarding EC2 instance logs and using CloudWatch Contributor Insights analyzes instance-level data, not specific ECS task stop events, making it difficult to pinpoint task-related errors. An Auto Scaling lifecycle hook for EC2INSTANCETERMINATING events is for instance termination, not for individual task stoppages. Writing to S3 and querying with Athena is a valid logging pattern but doesn't directly capture the ECS task stop events in real-time or provide the immediate analytical capabilities of CloudWatch Logs Insights for this specific use case.
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