Search code examples
aws-step-functions

Fetching number of active step function executions using boto3


I have only one Step Function defined and i invoke the step functions with different parameters.

I would like to set a limit for the executions (say max 10 executions in parallel).

Before invoking the step function i would like to have a check as below

if activate_step_function_execution_count() < 10:
    // invoke step function
else:
    // already 10 are in progress. do nothing and return

I am calling the step function from lambda using boto3. Is there any way i can achieve this method - activate_step_function_execution_count()

I checked on the boto3 sfn library. Couldnt find a method to get active executions.

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/stepfunctions.html


Solution

  • https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/stepfunctions.html#SFN.Client.list_executions

    I have figured it out. Running tag can get the list of active exeuctions.