2
votes

I couldn't find any answers I am looking for on the AWS documentations.

Is it possible to execute 100,000 (approx) Step Functions and the state has WAIT until 3 months? The wait state will check every 30 minutes, otherwise it will exit state after 2 months.

The wait state will execute a lambda function - it will check if a field (dynamodb) has matched condition before carry on the next state.

I like to know if there is any limitation?

If WAIT state is not good approach, what is alternative?

2

2 Answers

4
votes

Yes your State Machine's (SM) Wait state can wait up to 1 year. However the number of SMs you intend to run for two months would be a very expensive solution.

You intend to run 100,000 SMs and each SM's Wait state will execute a lambda after every 30 min. There is a probability that all 100,000 SMs are running for two months.

Assuming all SMs are running for 2 months, total number of transactions will be:

1 SM = 96 transactions (Wait to Lambda, Lambda to Wait) per day. 5760 transactions in 2 months per SM.

100,000 SM = 5760 * 100,000 = 576000000 transactions

First 4000 transactions are free so total transactions = 576000000 - 4000 = 575996000

$0.000025 per transactions after first 4000:

575996000 * 0.000025 = $14399.9 in two months.

$0.000025 is the cheapest, could be more depending on your region.

Also there is a risk of each SM execution history hitting the limit of 25,000.

I would suggest use either CloudWatch schedule event to run a Lambda every 30 min to verify the field in DynamoDB table or use DynamoDB streams to trigger Lambda for field verification. Once state is matched, you can then execute SMs. Both will be cheaper than step functions.

1
votes

Executions can exist for up to 1 year as per the AWS doucmentation. The maximum number of executions per account is 1,000,000.