Step Functions MAP state billing question

1

Hello,

I was wondering how billing works for the 'map' state in step functions. Let's say I have an array with 100 items and they are processed by map state. States in map state are;

1- pass 2- wait 3- pass

so in this case there are at least 300 transitions, right? Meaning almost 300 times more expensive than handling all items in a lambda function with a 'for loop' or something similar.

I could not find any documentation about the billing of map state. I hope somebody can help me out with this.

Thanks!

2 Answers
3
Accepted Answer

Each step execution, including the steps invoked by map state count as a billable step function state execution. So yes, if you execute 300 steps that is 300 times more expensive then executing 1 step -- in Step Functions Cost The total cost will depend on the cost of the lambda and anything it does as well.

One approach to managing large lists is to break the list into 'buckets' using the Map state, then send each 'bucket' to a lambda call. Example, if you have 1,000,000 objects, construct a map state that segments them into iterations of 1000 each, then call the lambda 1000 times with 1000 records each. Adjust the size of the buckets as needed for your use case so that the time it takes to execute each bucket is 'reasonable' for your case. If you already can process the largest size of your data set in 1 lambda call and there is no other value in splitting them up, then you dont need map. Or if the total cost of the worse case is small enough for your use case then use the approach that works best.

DALDEI
answered 2 years ago
0

It depends on the type of workflow you've selected. The standard one is billed by the number of state transitions, so yes if you loop with a map state, it will cost the number of iteration * the number of states in each iteration. If you can use the express workflow, the cost is much lower (you pay per number of executions).

How to choose: https://docs.aws.amazon.com/step-functions/latest/dg/concepts-standard-vs-express.html (the main limit is the 5 minutes duration for express vs 1 year for standard...)

Pricing: https://aws.amazon.com/step-functions/pricing/

profile pictureAWS
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions