Step Functions

  • Step Functions coordinate multiple AWS services into serverless workflows using State Machines.

  • A state machine is an abstract model which decides how one state moves to another based on a series of conditions.

  • Think of a state machine like a flow chart.

  • Step Functions automatically triggers and tracks each step, and retries when there are errors, so your application executes in order and as expected, every time

  • Amazon States Language is how you define all your states and is written in JSON.

  • There are two types of State Machines available:

  • Standard - general purpose, long workloads

  • Express - streaming data, short workloads

  • Use Cases for Step Functions:

  • Manage a batch job, Fargate or ECS container

  • Sequential batch processing

  • Creating a pipeline to transcode media files

  • Transferring data records, by performing operations on each record queued up via SQS

  • Sequence steps of ML workflows

  • Coordinate Extract, Transform and Load (ETL) Jobs

  • The type of Step Functions States

    • Pass State Passes its input to its output, without performing work (dummy/mock). Pass states are useful when constructing and debugging state machines.
    • Task State represents a single unit of work performed by a state machine.
      • Lambda - triggers a lambda function
      • Activity the work is performed by a worker that can be hosted on anywhere eg. EC2, ECS, mobile phones
    • Supported AWS Services pass parameters to the APl of an AWS Service
    • Choices State adds branching logic to a state machine.
    • Wait State delays the state machine from continuing for a specified time.
    • Succeed State stops an execution successfully
    • Fail State stops the execution of the state machine and marks it as a failure
    • Parallel State can be used to create parallel branches of execution in your state machine The state machine doe not move forward until both states complete
    • Map State can be used to run a set of steps for each element of an input array.