Step Functions

coordination, orchestration for distributed applications

Document | Workshop |

Overview

  • Similar to Microsoft Power Automate. A GUI workflow.

  • Help build visual workflow to translate business requirements to technical requirements.

  • Build apps fast, manage logic with low-code.

  • Built-in try/catch, retry, rollback.

  • Keywords: orchestration

Features

Workflow configuration

Built-in service primitives

AWS service integration

  • Lambda, ECS, Fargate

  • DynamoDB

  • SNS, SQS

  • AWS Batch, AWS Glue

  • SageMaker

Coordination of distributed apps

Can make http connection between app hosted on EC2, on-premises, mobile devices.

Components reuse

Built-in error handling

  • Retry failed or time-out tasks.

  • Response differently depend on type of error.

History execution

Cost

Pay for each state transition.

Concepts

  • Amazon State Language: is a JSON-based, structure language use to define state machine.

  • "Type": "Parallel" use to create parallel branches state machine.

  • Task: is a single unit of work and choice.

  • State: a step in the workflow

    • Pass state: debugging (just pass the input to its output, or inject some fixed data)

    • Task state: do some works in your state machine. eg.Lambda

    • Choice state: if-else statement

    • Wait state: delay for a certain amount of time

    • Success state: stop & mark as success

    • Fail state: stop & mark as failure.

    • Parallel state: create parallel branches of the same input

    • Map state: as LOOP statement (execute the same step for multiple entries)

  • HeartbeatSeconds: maximum interval that the task will wait for a hearbeat signal. If an activity worker fails to send heartbeats within this interval, the state is failed. A retry policy on the state allows another activity worker to attempt to complete the state.

HeartbeatSeconds vs Wait State:

  • HeartbeatSeconds: This is a parameter used within a Task state to specify the maximum interval the task will wait for a heartbeat signal. If no heartbeat is received within this interval, the task is marked as failed and can retry based on a defined policy.

  • Wait State: This is a state type used to introduce a deliberate delay in the execution of a state machine for a specified amount of time before transitioning to the next state. It is useful for adding pauses or delays in the workflow.

In essence, HeartbeatSeconds is about keeping a Task alive, while Wait state is about intentionally pausing the workflow.

Last updated