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 |
Pingback: AWS Lambda invoking from code | Active Intelligence