Search code examples
amazon-web-servicesaws-lambda

How to increase recursive invocations limit in AWS lambda?


I have a lambda function that asynchronously invokes itself in a chain reaction 30 times in a row, however AWS stops at invocation #16 because of the infinite loop detection

Is there a way I can raise that limit of 16 for my function?


Solution

  • You can allow for recursiveness, while this is dangerous and requires failover mechanisms, can be done.

    aws lambda put-function-recursion-config --function-name yourFunctionName --recursive-loop Allow
    

    As per other solutions, using a FIFO queue will increase the complexity with no real benefits, since AWS recursiveness protection also detects when it happens in said scenario:

    loops that Lambda can detect

    https://docs.aws.amazon.com/lambda/latest/dg/invocation-recursion.html