AWS Lambda invoking from code

You can invoke a lambda from your code (details); you’d probably want to use the AWSLambdaAsyncClient.

CAUTION: you have to be very careful not to make re-cursive calls (unless that is your intention); otherwise you might get into an infinite loop.  Even worse if you are making several recursive calls you might exponentially increase the number of lambda instances that are running.

Here is a small snippet attempting to ensure that you are not making direct-recursive calls (note that you might still end up with indirectly recursive calls); use at your own risk; add the following to your handler function:

if (context.getFunctionName.equals(nextFunctionName)){
  throw new RuntimeException( context.getFunctionName + "is making a recursive lambda call")




keywords: call lambda from java scala code directly




About Neil Rubens

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

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