An ECS service on Linux EC2 has containers in some tasks stop with exit code 137. Service-wide average memory usage is low, and Container Insights enhanced observability is enabled.
Distinguish a memory-limit breach, host memory pressure, and other termination causes. Stopped-task details, logs, and the relevant task-definition revision are available.
Which investigation is most appropriate?
Correlate the stopped container's usage, termination details, logs, and task definition instead of inferring an OOM cause from an exit code alone.
Detailed explanation
An aggregate can hide a spike in one container; investigate the affected TaskId and container.
An aggregate can hide a spike in one container; investigate the affected TaskId and container.
The exit code alone does not identify the cause. Even OOM can involve host constraints, so termination evidence is needed.
The exit code alone does not identify the cause. Even OOM can involve host constraints, so termination evidence is needed.
Resource and termination evidence identify the affected container and support further investigation of limits, host pressure, and application behavior.
Resource and termination evidence identify the affected container and support further investigation of limits, host pressure, and application behavior.
memoryReservation is a soft reservation, distinct from a memory hard limit and available host memory.
memoryReservation is a soft reservation, distinct from a memory hard limit and available host memory.
Check official documentation
Compare the following points with the official documentation.
Review enhanced ContainerMemoryUtilized dimensions, DescribeTasks termination fields, and Linux memory versus memoryReservation.
Official references
What to confirm
Distinguish the service aggregate from the affected container and investigate both allocation limits and host constraints.
Key points
- ContainerMemoryUtilized
- stoppedReason
- memoryReservation
Notes
- Environment: AWS SOA-C03 exam guide and the linked AWS documentation
- Reviewed against the linked AWS documentation on 2026-10-04.
Foundation review
Align evidence for the stopped container
Select ContainerName, TaskId, ServiceName, and ClusterName in ECS/ContainerInsights and inspect ContainerMemoryUtilized near the stop. Correlate DescribeTasks stoppedReason and containers reason/exitCode with application logs. An aggregate average or sampling gaps cannot rule out a brief peak.
Separate reservation, ceiling, and host capacity
In Linux container definitions, memory is a hard limit and memoryReservation a soft reservation. Usage above the reservation is not itself a fault. OOM can involve allocation limits or host constraints, so inspect host pressure and application growth before choosing a configuration change.