Queues & Background Processing in Depth · Workflows and Operations

Managed Orchestration: Step Functions and Friends

Serverless state machines for cloud-native workflows.

AWS Step Functions defines workflows as state machines (Amazon States Language) with built-in retries, catch/compensation, parallel branches, waits and direct integrations (Lambda, SQS, DynamoDB, ECS). Standard workflows run up to a year with exactly-once state transitions; Express workflows are cheaper and at-least-once for high volume. Similar: Google Workflows, Azure Logic Apps/Durable Functions. They trade code flexibility for zero infrastructure and visual tracing.

Workflow engines

Criterion Step Functions Standard Step Functions Express Temporal
Max duration 1 year 5 minutes Unlimited
Semantics Exactly-once transitions At-least-once Durable replay
Authoring JSON/YAML state machine Same Code (Go/Java/TS/Python/.NET)
Hosting Managed Managed Self-hosted or Temporal Cloud
Cost model Per state transition Per duration/requests Infra or per action
{
  "StartAt": "ReserveStock",
  "States": {
    "ReserveStock": { "Type": "Task", "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": { "FunctionName": "reserve-stock", "Payload.$": "$" },
      "Retry": [{ "ErrorEquals": ["States.TaskFailed"], "IntervalSeconds": 2, "BackoffRate": 2, "MaxAttempts": 5, "JitterStrategy": "FULL" }],
      "Next": "ChargePayment" },
    "ChargePayment": { "Type": "Task", "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": { "FunctionName": "charge-payment", "Payload.$": "$" },
      "Catch": [{ "ErrorEquals": ["PaymentDeclined"], "Next": "ReleaseStock" }],
      "Next": "Ship" },
    "ReleaseStock": { "Type": "Task", "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": { "FunctionName": "release-stock", "Payload.$": "$" }, "Next": "Failed" },
    "Ship": { "Type": "Task", "Resource": "arn:aws:states:::sqs:sendMessage",
      "Parameters": { "QueueUrl": "https://sqs.eu-west-1.amazonaws.com/123/shipments", "MessageBody.$": "$" }, "End": true },
    "Failed": { "Type": "Fail" }
  }
}

Common pitfalls

  • Complex business logic in giant JSON state machines.
  • Express workflows for non-idempotent steps.
  • Ignoring per-transition costs at high volume.

Key points

  • State machines with retries/catch
  • Standard vs Express semantics
  • Code-first engines for complex logic

Further reading: AWS Step Functions

Practice questions

What's the main difference between Step Functions Standard and Express workflows?

Answer

Standard: long-running (up to a year), exactly-once state transitions, priced per transition. Express: short (≤5 min), high-volume, at-least-once, priced by duration and requests.

When would you choose Temporal over Step Functions?

Answer

When workflows involve complex logic best expressed in code, need portability across clouds, or very long/unbounded durations.

Open in the app to mark lessons complete, take notes and track your progress.