Introduction to AWS Step Functions

avik6028

Avik Kundu

Posted on July 26, 2022

Introduction to AWS Step Functions

AWS cloud provides various services to build serverless applications on their platform. There are compute services like AWS Lambda and AWS Fargate, while there are other integration services which binds various compute services, like AWS Step Functions, Amazon API Gateway, etc.

In this article, we are going to explore AWS Step Functions.

Introduction

The official definition of AWS Step function is as follows:

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

One of the most important characteristics of Step functions is that it uses Finite State Machines (FSM) model. The state machines does a simple job of using the states and functions to perform the tasks it is assigned to complete. The use of state machines guarantees the fact of not having the issue of infinite loops, which is itself a costly operation.

The two most important keywords are States and Transitions. A machines gets defined by its states and the relationships between them, known as transitions.
Adding of more states increases the complexity of the FSM. The state machines are defined using the JSON-based Amazon States Language.

When to use Step Functions

The service improves application resiliency in a multitude of ways. For example, developers can implement checkpoints and restarts to ensure application tasks execute in order and as expected. They can use built-in try/catch capabilities to deal with errors and exceptions automatically. And they can even set their own retry handling parameters around backoff rates, max attempts, and error equals.

Furthermore, AWS Step Functions integrates seamlessly with other AWS services. Developers can set it to run in parallel with other tasks, hold for external workflows, or wait for other internal jobs to finish. Users can incorporate machine learning programs into their applications with AWS SageMaker, batch computing capabilities with AWS Batch, serverless ETL through AWS Glue, and much more.

AWS Services

Step Functions are also beneficial for long-running or delayed workflows. It allows you to have a workflow for up to a year while also implementing the waiting state.

Deep-Dive into Step Functions

Types of States

There are 8 types of states:

  • Task state – Do some work in your state machine. AWS Step Functions can invoke Lambda functions directly from a task state.
  • Choice state – Make a choice between branches of execution
  • Fail state – Stops execution and marks it as failure
  • Succeed state – Stops execution and marks it as a success
  • Pass state – Simply pass its input to its output or inject some fixed data
  • Wait state – Provide a delay for a certain amount of time or until a specified time/date
  • Parallel state – Begin parallel branches of execution
  • Map state – Adds a for-each loop condition

Important Features

  • AWS Step Functions allows you to combine your pre-existing Lambda functions and microservices into new compositions while coordinating them. Your workflow's tasks can be executed everywhere, on instances, containers, functions, and mobile devices, among other platforms.
  • Step Functions maintain a strict barrier between your application's logic and implementation. You can change the order of the steps and add, move, swap, and reshuffle them without altering your business logic.
  • Whether the operation takes seconds or months to complete, Step Functions automatically manages errors and exceptions with built-in try/catch and retry.
  • Step Functions maintains service capacity across several Availability Zones in each region and has built-in fault tolerance, ensuring high availability for both the service and the application workflow it supports.
  • Step Functions automatically scales the operations and underlying compute to run the steps of your application for you in response to changing workloads.
  • AWS Step Functions has a 99.9% SLA.
  • AWS Step Functions enables access to metadata about workflow executions so that you can easily identify related resources. This makes it easier to correlate logs for faster debugging and to measure workflow performance data.
  • It also supports callback patterns. Callback patterns automate workflows for applications with human activities and custom integrations with third-party services.
  • AWS Step Functions supports workflow execution events, which make it faster and easier to build and monitor event-driven, serverless workflows. Execution event notifications can be automatically delivered when a workflow starts or completes through CloudWatch Events, reaching targets like AWS Lambda, Amazon SNS, Amazon Kinesis, or AWS Step Functions for automated response to the event.

Pricing

Every time a step of your workflow is completed, Step Functions counts a state transition. All of your state machines' combined state transitions, including retries, are counted when calculating your fee.

💖 💪 🙅 🚩
avik6028
Avik Kundu

Posted on July 26, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related