Subchapter 42.7
references/orchestration.mdMarkdown7 KBView on GitHub
Step Functions and EventBridge decision matrices, error semantics, and limits. Assumes you can write Amazon States Language (Saga/Parallel/Map/Choice JSON) and EventBridge patterns — this file focuses on the choices and gotchas.
| Dimension | Standard | Express |
|---|---|---|
| Max duration | 1 year | 5 minutes |
| Execution semantics | Exactly-once | At-least-once (async) / At-most-once (sync) |
| Execution history | Stored 90 days (API/console) | CloudWatch Logs only (must enable) |
.sync integration | Supported | Not supported |
.waitForTaskToken | Supported | Not supported |
| Distributed Map | Supported | Not supported |
| Activities | Supported | Not supported |
| Idempotency | Automatic (execution name unique 90 days) | Not managed |
Express sub-types: Async (fire-and-forget, results via CloudWatch Logs); Sync (blocks until completion, invokable from API Gateway/Lambda/StartSyncExecution, 5-min max).
| Use case | Type |
|---|---|
Long-running, .sync/callback, non-idempotent (payments) | Standard |
| Distributed Map (large-scale parallel) | Standard |
| High-volume event processing (IoT, streaming) | Express |
| API-backed synchronous microservice orchestration | Synchronous Express |
ItemBatcher/ItemReader/ResultWriter. Standard workflows only.Default branch.Common patterns (write the ASL directly): Saga (each step has a compensating undo via Catch, chained in reverse); Parallel (concurrent branches); Map (iterate an array); Agentic AI loop (bedrock:invokeModel → Choice on stop_reason = 'tool_use' → execute tool → loop). Prefer direct SDK integrations (200+ services) over Lambda intermediaries to cut latency, and prefer JSONata for inline transforms over a Lambda task.
| Error Name | Retriable? | Notes |
|---|---|---|
States.ALL | Yes | Wildcard — but does NOT match the two terminal errors below |
States.TaskFailed | Yes | Wildcard for task errors (except States.Timeout) |
States.Timeout / States.HeartbeatTimeout | Yes | Exceeded TimeoutSeconds / missed HeartbeatSeconds |
States.Permissions | Yes | Insufficient IAM privileges |
States.DataLimitExceeded | No | Payload > 256 KiB — terminal |
States.Runtime | No | Invalid JSONPath, null payload — terminal |
States.ItemReaderFailed / States.ResultWriterFailed | Yes | Map source/destination errors |
States.ALLdoes NOT catchStates.DataLimitExceededorStates.Runtime. These are terminal and must be designed around, not retried.
"Retry": [
{ "ErrorEquals": ["States.Timeout"], "IntervalSeconds": 3, "MaxAttempts": 2,
"BackoffRate": 2.0, "MaxDelaySeconds": 30, "JitterStrategy": "FULL" },
{ "ErrorEquals": ["Lambda.ServiceException", "Lambda.SdkClientException"],
"IntervalSeconds": 1, "MaxAttempts": 3, "BackoffRate": 2.0 },
{ "ErrorEquals": ["States.ALL"], "IntervalSeconds": 1, "MaxAttempts": 3, "BackoffRate": 2.0 }
]Defaults: IntervalSeconds 1, MaxAttempts 3 (0 = never), BackoffRate 2.0, JitterStrategy "NONE".
Rules and best practices:
States.ALL must be last in the Retry array; retries are attempted before catchers.TimeoutSeconds on every Task; always retry Lambda.ServiceException / Lambda.SdkClientException.JitterStrategy: "FULL" to prevent thundering herd; HeartbeatSeconds for long tasks.Catch with ResultPath: "$.error-info" preserves the original input alongside the error (without it, error output replaces the input).source: aws.states, detail-type: Step Functions Execution Status Change, status: [FAILED, TIMED_OUT, ABORTED]).All specified fields must match (AND); values within an array are OR’d. Operators: exact ["value"], {"prefix"}, {"suffix"}, {"anything-but"}, {"numeric": [">", 0, "<=", 100]}, {"exists": true}, {"wildcard": "prod-*-east"}.
| Dimension | Pipes | Rules |
|---|---|---|
| Topology | Point-to-point (1→1) | Fan-out (1→N) |
| Flow | Source → Filter → Enrichment → Transform → Target | Event routing on a bus |
| Sources | SQS, Kinesis, DynamoDB Streams, MSK, MQ | Any event on a bus |
| Enrichment | Built-in (Lambda, API GW, API Destinations, Sync Express SFN) | Not built-in |
| Use case | Replace Lambda glue for source→target | Event routing and distribution |
Pipes filtering happens at the source — you pay only for matched events — with built-in retry + DLQ.
Lambda durable functions let you write reliable multi-step workflows as plain code (TS/Python/Java) with automatic checkpointing — the SDK persists each step and replays from the checkpoint on interruption, enabling executions up to 1 year with zero compute during waits. For full guidance use the aws-lambda-durable-functions skill (see SKILL.md routing).
| Question | Lambda durable functions | Step Functions |
|---|---|---|
| Programming model | Standard code (TS/Python/Java) | Amazon States Language / visual designer |
| AWS service integrations | Primarily Lambda | 200+ native integrations |
| Who reads the workflow | Developers | Non-technical stakeholders too |
| Best for | Distributed transactions, stateful logic, AI agent loops | Business process automation, multi-service orchestration |