Search code examples
aws-step-functions

will an aws step workflow work with an infinite loop?


I am considering using step functions to poll every 30 seconds for updates from an external db and run a mapping lambda that will store the data in s3.

Implementing the step functions is straightforward enough. I have noticed the limits are set to run for 1 year. http://docs.aws.amazon.com/step-functions/latest/dg/limits.html

the question i have is will this work or is there a flaw in using step functions for this purpose. the price of 0.025 per 1000 steps is acceptable for my scenario.


Solution

  • No. The size of the execution history of a step function execution is limited to 25,000 events. Each Lambda task takes 5 events. So you can only have 500 states execution in a single execution of state machine.

    In your case, the execution of state machine will fail after 30*5000 seconds ( ~4 hours). You may need to start a new execution every 4 hrs to make sure your DB sync works.

    How to mitigate this?

    AWS Step Functions history event limitation

    Note: Though this question is old, I am answering this for the benefit of future readers.