AWS Step Functions Add 14 New Intrinsic Functions

Jesse Warden - Sep 1 '22 - - Dev Community

AWS added 14 new intrinsic functions to Step Functions. Beyond the "I can delete my Lambdas that were doing this now and using native Step Function JSON/YAML", I thought I'd list some of the awesomeness you can more easily do now. It's little, but still enjoyable.

https://aws.amazon.com/about-aws/whats-new/2022/08/aws-step-functions-14-new-intrinsic-features-process-data-workflows/

ArrayContains

A lot of the if/then's which control conditional logic were often just relegated to small Lambdas to inspect strings in arrays. Given most were just strings, or checking a property value of an Object, you'd wish Step Functions could do this because it's mostly dealing with JSON Objects to begin with; now it's native and you can see the logic in the Step Function vs. "whatever the Lambda did".

ArrayGetItem

Many Lambdas used for Loops, or processing a list of things now go away because you can get an item at an index, moving many more state handling to Step Functions where it belongs.

ArrayLength

Sometimes you have no data to process and that's ok, but hard to know if it was Step Function's fault or Lambdas; now "dude, no data in Array, we're good!" Some step functions can "succeed, fail, or no data". That last one is huge for more intelligent monitoring.

JsonMerge

Huge. I'd make Parallel states just to emulate State Monads (a JavaScript promise that returns a tuple vs. just 1 piece of data). It made the Step Function complicated looking; now, "when 2 jay-sons come along... you must zip it!"

UUID

So many Lambdas for this 1 function...

ArrayPartition

Tricky, but still helpful. Often lists are too big for Map/Parallel. Now you can partition a big array. Instead of doing "one thousand things..." you can now do "10 at a time, then proceed to the next". For batch data, or emulating SQS batch. Godsend method.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .