A Lambda dies with `Runtime exited with error: signal: killed` and `Runtime.ExitError`, and no stack trace.
IntermediateTroubleshootingECS, EKS, ECR and Lambda
Answer
Likely causes → The function ran out of memory. The REPORT line shows Max Memory Used equal to Memory Size. Large files loaded into memory, or a leak across warm invocations from global caches, are common reasons.
Diagnose →
aws logs filter-log-events --log-group-name /aws/lambda/etl \
--filter-pattern 'REPORT' --max-items 5 --query 'events[].message'
Fix →
- Raise
MemorySize. Use Lambda Power Tuning to find the cheapest setting that works - Stream large objects instead of loading them whole, and use
/tmp(configurable up to 10 GB) for scratch space - Clear global caches between invocations
Prevent → Alarm when Max Memory Used goes above 80% of the configured memory (through Lambda Insights).
More on ECS, EKS, ECR and Lambda
`docker push 111111111111.dkr.ecr.us-east-1.amazonaws.com/api:1.4` fails with `no basic auth credentials` (or `denied: Your authorization token has expired. Reauthenticate and try again.`).BeginnerFargate tasks stop with `CannotPullContainerError: pull image manifest has been retried 5 time(s): failed to resolve ref ... dial tcp 52.x.x.x:443: i/o timeout`.Intermediate`ResourceInitializationError: unable to pull secrets or registry auth: ... AccessDeniedException: User: arn:aws:sts::111111111111:assumed-role/ecsTaskExecutionRole/... is not authorized to perform: secretsmanager:GetSecretValue`.IntermediateA task stops with `Essential container in task exited`, exit code 137, and reason `OutOfMemoryError: Container killed due to memory usage`.BeginnerThe ECS service event says `service api was unable to place a task because no container instance met all of its requirements. The closest matching container-instance ... has insufficient memory available.`IntermediateAn ECS deployment rolls back automatically, and the event says `deployment failed: tasks failed to start` from the circuit breaker.Advanced