AWS Lambda: extending execution time limit

Currently AWS Lambda limits execution time to 5 min.  However, in quite a few cases it is possible to overcome this limitation by simply re-invoking your function in an iterative manner.  Here are brief details.

You can keep a tab on remaining time with:   com.amazonaws.services.lambda.runtime.Context#getRemainingTimeInMillis

Once you are almost out of time you can simply re-invoke your own function directly from lambda (details); make sure to use the AWSLambdaAsyncClient and pass to your function whatever it needs to continue; e.g. resumptionPoint, intermediateResults etc.  And make sure you don’t get into an infinite loops (its going to be expensive).

 

 

 

keywords

Maximum execution duration per request 300 seconds

 

 

About Neil Rubens

see http://ActiveIntelligence.org

This entry was posted in Uncategorized. Bookmark the permalink.

One Response to AWS Lambda: extending execution time limit

  1. Pingback: AWS Lambda invoking from code | Active Intelligence

Leave a Reply

Your email address will not be published. Required fields are marked *

*