A Lambda function hits the 15-minute limit
A Lambda function unzips and validates partner files. Files have grown, and some runs now hit the 15-minute maximum and fail. What are your options?
Think it through or sketch an answer first, then open the hint or the solution.
Show a hint
Either split the work into pieces that each fit, or move it to a service without that limit.
Show the solution
Lambda has a hard 15-minute limit. Options: split the work and fan it out (Step Functions with a Map or Distributed Map state over chunks or files); or move long work to a service built for it, such as AWS Glue for Spark or Python shell jobs, ECS on Fargate for a container, or EMR Serverless for big Spark jobs. Keep Lambda for the trigger and orchestration.
Common mistakes
- Raising memory and hoping it runs faster: it may help, but the limit stays.
- Calling the function recursively from itself to continue, which is hard to monitor and to stop.
How did you do? Your answer is saved in this browser and comes back for revision later.
Learn more
- Workloads Longer Than Lambda's 15 MinutesAWS Overview
- Map: Fan-Out over Many ItemsAWS Step Functions
- Invocation ModelsAWS Lambda