Q4 — AWS DOP-C02 Ch.2

Question 4 of 100 | ← Chapter 2

A developer manages the company's Amazon Elastic Container Service (ECS) cluster. The cluster runs on several Amazon EC2 instances located in an Auto Scaling group. The developer wants to implement a solution that logs and reviews stopped tasks to identify errors.

Correct Answer: A. Create an Amazon EventBridge rule to capture task state changes. Send events to Amazon CloudWatch Logs. Use CloudWatch Logs Insights to investigate stopped tasks.

Explanation

Amazon EventBridge can monitor and respond to ECS task state change events, forwarding related activity to Amazon CloudWatch Logs. CloudWatch Logs Insights enables querying and analysis of log data to effectively identify root causes of stopped tasks. Option B focuses on embedded metrics rather than detailed logs; option C's Contributor Insights identifies frequent log patterns but does not directly handle task state events; option D's Auto Scaling lifecycle hooks target EC2 instances—not ECS tasks. The combination of EventBridge and CloudWatch Logs directly fulfills the requirement to collect and analyze task stop events. Refer to AWS documentation on ECS event integration and log analysis.