AWS Step Functions — Orchestrate Distributed Transactions for Microservices

In this article, we are going to learn AWS Step Functions — Orchestrate Distributed Transactions for Microservices.

AWS Step Functions is a low-code, visual workflow service that developers use to build distributed applications. By the end of the article, we will see AWS Step Functions Main Features, Core Concepts, Use Cases and How it works?

I have just published a new course — AWS Lambda & Serverless — Developer Guide with Hands-on Labs.

What is AWS Step Functions ?

AWS Step Functions is a serverless orchestration service that lets us combine AWS Lambda functions and other AWS services to build business-critical applications. With Step Functions’ graphical console, we see application’s workflow as a series of event-driven steps.

Step Functions is based on state machines and tasks. A state machine is a workflow. A task is a state in a workflow that represents a single unit of work that another AWS service performs. Each step in a workflow is a state.

So AWS Step Functions makes it easier to orchestrate multiple AWS services to accomplish tasks. Step Functions allows you to create steps in a process where the output of one step becomes the input for another step, all using a visual workflow editor. Step Functions provides quite a bit of convenient functionality: automatic retry handling, triggering and tracking for each workflow step, and ensuring steps are executed in the correct order.

Benefits of using AWS Step Functions

We are going to learn Benefits and Drawbacks of using AWS Step Functions. There are several advantages of AWS Step Functions but we will summarized for important ones:

  • We can get started quickly with Workflow Studio, a simple drag-and-drop interface. This will provide Build and deploy rapidly.
  • Step functions integrates AWS resources from over 200 services. So that means we write less integration code.
  • Step Functions manages state, checkpoints, and it has built-in try/catch, retry, and rollback capabilities deal with errors. So by default it is Build fault-tolerant and stateful workflows.
  • Decouple application workflow logic from business logic that is another best practice of Serverless development.

Drawbacks of AWS Step Functions

There are also some disadvantages of AWS Step Functions:

  • AWS Step Functions using Amazon States Language for configurations. Amazon States Language is quite complex; its syntax is based on JSON and therefore optimized for machine readability instead of readability by humans.
  • In some cases it makes over-complicated to business flows when using unnecessary cases.
  • Since Amazon States Language only used in AWS Step Functions, it becomes with vendor lock-in problem. if you decide to migrate to a different cloud provider, you’ll need to re-implement the orchestration layer or replace it with another vendor’s alternative.

Use Cases of AWS Step Functions

AWS Step Functions has several use cases that are fit the usage of AWS Step functions:

  • When application has long-running tasks and need to automate those then AWS Step functions is a good option. For example ETL jobs.
  • Machine Learning Data Preparations. To Collect, process and execute machine learning pipelines we can use AWS Step Functions.
  • I have mostly use Step Functions to combine multiple AWS Lambda functions into responsive serverless applications and microservices.
  • Also it can be used in IT and security automation areas.

AWS Step Functions Core Concepts — State Machine, States, Task, Pass, Wait, Choise, Parallel, Succeed, Fail

We are going to learn AWS Step Functions Core Concepts — State Machine, States, Task, Pass, Wait, Choice, Parallel, Succeed, Fail.

State Machine

State machine is defined as a type of computational device that is able to store various status values and update them based on inputs. AWS Step Functions builds with this concept and uses the state machine to refer to an application workflow.


States are provide to make decisions based on their input, perform actions, and pass output to other states. In AWS Step Functions you define your workflows in the Amazon States Language.

A state represents a step in your workflow. States can perform a variety of functions:

  • Perform work in the state machine (Task state)
  • Choose between different paths in a workflow (Choice state)
  • Stop the workflow with failure or success (a Fail or Succeed state)
  • Pass output or some fixed data to another state (Pass state)
  • Pause the workflow for a specified amount of time (Wait state)
  • Begin parallel branches of execution (Parallel state)
  • Repeat execution for each item of input (Map state)

You can find an example state named HelloWorld that performs an AWS Lambda function:

“HelloWorld”: {
“Type”: “Task”,
“Resource”: “arn:aws:lambda:us-east-1:123456789012:function:HelloFunction”,
“Next”: “AfterHelloWorldState”,
“Comment”: “Run the HelloWorld Lambda function”

AWS Step Functions Workflow types — Standard vs. Express Workflows

When we create a state machine, we have to select a Type of Step Function which’s are Standard (default) or Express. In both cases, we define your state machine using the Amazon States Language.

Standard Workflows

We can choose a standard workflow for processes that are long-running or that require human intervention. Standard Workflows are ideal for long-running, durable, and auditable workflows.

Express workflows

Express workflows are well-suited for short-running about fewer than five minutes, high-volume processes. Express Workflows are ideal for high-volume, event-processing workloads such as IoT data ingestion, streaming data processing and transformation, and mobile application backends.

AWS Step Functions — Walkthrough with AWS Management Console

we are going to getting started with AWS Step Functions using AWS Management Console.

In Workflow Studio, we’ll create a state machine containing multiple states, including Pass, Choice, Fail, Wait, and Parallel. You’ll use the drag and drop feature to search for, select, and configure these states. Then, you’ll view the auto-generated Amazon States Language JSON code for your workflow, exit Workflow Studio, run the state machine, and review the execution details.

Lets see our topics that we are going to do in this section:

  • Navigate to Workflow Studio
  • Create a state machine
  • Review the auto-generated Amazon States Language definition
  • Start a new execution
  • Update your state machine

To see full developments of this hands-on lab, you can check below course on Udemy.

Step by Step Design AWS Architectures w/ Course

I have just published a new course — AWS Lambda & Serverless — Developer Guide with Hands-on Labs.

In this course, we will learn almost all the AWS Serverless Services with all aspects. We are going to build serverless applications with using AWS Lambda, Amazon API Gateway, Amazon DynamoDB, Amazon Cognito, Amazon S3, Amazon SNS, Amazon SQS, Amazon EventBridge, AWS Step Functions, DynamoDB and Kinesis Streams. This course will be 100% hands-on, and you will be developing a real-world application with hands-on labs together and step by step.

Source Code

Get the Source Code from Serverless Microservices GitHub — Clone or fork this repository, if you like don’t forget the star. If you find or ask anything you can directly open issue on repository.




AWS Serverless with AWS Lambda, API Gateway, Amazon DynamoDB, Cognito, S3, SNS, SQS, EventBridge, Step Functions, DynamoDB and Kinesis Streams, CloudFormation, SAM, CDK. We will develop Lambda-based event-driven application integrate to all AWS Serverless Services.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mehmet Ozkaya

Software Architect | Udemy Instructor | AWS Community Builder | Cloud-Native and Serverless Event-driven Microservices