java – AWS Lambda: Task timed out

java – AWS Lambda: Task timed out

Amazon Lambda is designed to be used as an event-driven system that responds to events. The flow is:

  • Something happens somewhere that triggers Lambda (eg an upload to Amazon S3, data coming into an Amazon Kinesis stream, an application invoking the Lambda function directly)
  • The Lambda function is created, data from the trigger event is passed
  • The Lambda function runs

Lambda functions are limited to a maximum execution time of 15 minutes (this was recently increased from the original 5 minutes timeout). The actual limit is configured when the Lambda function is created. The limit is in place because Lambda functions are meant to be small and quick rather than being large applications.

Your error message says Task timed out after 15.00 seconds. This means that AWS intentionally stopped the task once it hit a run-time of 15 seconds. It has nothing to do with what the function was doing at the time, nor the file that was being processed.

To fix: Increase the timeout setting on the configuration page of your Lambda function.

It seems you configured the timeout for 15 seconds.You may increase the timeout as described in this screenshot and as per lambda settings maximum time it allow you to execute is 15 minutes.


java – AWS Lambda: Task timed out

In my case when the task worked fine locally but timed out on Lambda, it was because I needed to increase the Memory allocated to the Lambda instance.

Leave a Reply

Your email address will not be published.