Living up to their claim of offering the world’s most comprehensive cloud platform, Amazon introduced in late 2016 a new AWS service, Step Functions.
Step Functions is a service which provides a reliable and easy way to orchestrate microservices using visual workflows, mainly by coordinating AWS Lambda functions. As the name implies, it enables developers to set up workflows which step through multiple types of functions that are linked together. The resulting workflow is highly flexible and can be scaled on demand.
Why did Amazon find developing Step Functions necessary? Since the introduction of AWS Lambda in 2014, developers have been able to build on-demand applications that are responsive to events and new information. However, they found it difficult to maximize the potential of Lambda functions as there was no simple way of running functions in sequence or parallel, retry functions for a specified number of times, select functions based on data resulted in a previous function, or other similar requirements.
In order to solve these shortcomings, Amazon introduced Step Functions, allowing developers to orchestrate AWS Lambda’s functions and tasks. The Amazon Simple Workflow already provided this functionality, but the fully managed Step Functions service is much easier to use and implement.
So far, we’ve seen that Step Functions enables developers to control multiple executions of Lambda functions in order to achieve complex behaviour. This includes running functions in parallel or sequentially, choosing between workflow branches, waiting, or stopping the execution of a function based on the failure rate.
All this is possible as Step Functions offers State as a Service to an otherwise serverless and stateless Lambda function. Step Functions uses states to progress the workflow from one step to the next, coordinating them to run in the right order depending on the results of previous functions.
As with all other the other Amazon Web Services, Step Functions features a pay-as-you-go pricing model. Each function is billed for each state transition of the execution. For each account, the first 4,000 transitions per month are included in the free tier.
Step Functions can be built and managed in three different ways:
Amazon mention the following use cases for their service, as well as kindly providing a comprehensive list of detailed workflows for SFN:
We can also look at real-world cases where the system has been implemented successfully:
In order to ensure that their database and website are being constantly updated with the latest prices and product availability, The Take have used Step Functions to create a multi-step automatic product updating system.
Foodpanda say that Step Functions has played a crucial role in enabling them to manage peak times for customer demand, as well as easily change and optimize their service.
Servian has used Step Functions to process customer reviews, focusing on solving negative reviews quickly and proactively. They have created a process in which each review is categorised by metadata, analysed the sentiment of the review using AWS Comprehend, send out notifications and update the review database.