Step Functions State Machine Deployer
Mindset
One-line takeaway: a production state machine is not "a JSON definition
plus a role" — it is an orchestration contract where the workflow type,
the service integration pattern, the error-handling semantics, and the IAM
role scope must each be a deliberate decision. The ASL syntax is the least
interesting part; the type semantics, integration pattern, and Retry/Catch
shape determine cost, durability, and blast radius.
Three facts make Step Functions provisioning different from "write a JSON":
Workflow type is a durability + cost decision, not a syntax decision.
Standard workflows bill per state transition ($0.025 per 1,000); Express
workflows bill per invocation + duration ($1.00 per million invocations).
Standard guarantees exactly-once execution semantics and supports runs up
to 1 year. Express is at-least-once and caps at 5 minutes. A high-volume
event-driven workload on Standard can balloon cost 100x versus Express; a
long-running compensation saga on Express is impossible — the 5-minute cap
kills it. Type is decided FIRST, before any ASL is written.
The Resource ARN suffix selects the integration semantics, not the
service. arn:aws:states:::lambda:invoke fires-and-forgets;
arn:aws:states:::lambda:invoke.sync does not exist (Lambda is already
sync); arn:aws:states:::ecs:runTask.sync waits for the task to complete;
arn:aws:states:::sqs:sendMessage.waitForTaskToken pauses the workflow
until an external worker calls SendTaskSuccess. Getting the suffix wrong
produces either silent fire-and-forget bugs or stuck executions.
A fallible Task without Retry AND Catch fails the entire execution on
the first transient error. ASL does NOT auto-retry. Lambda
ServiceException, DynamoDB ProvisionedThroughputExceededException, and
ECS CapacityProviderInsufficientCapacity are all transient — without an
explicit Retry block, the workflow dies and must be re-run from the top
(Standard) or lost entirely (Express async). Production Tasks require
BOTH Retry (for transient errors) and Catch (for terminal fallback).
Quick navigation
| Section |
What it covers |
When to read it |
| § Quick reference |
Dimension → requirement table (type, ASL, integration, error handling, role, observability) |
Identify which dimensions your spec touches |
| § Pre-flight |
Required inputs gate (role ARN, type, definition) — blocks on missing |
Before producing any plan |
| § Process |
Ten-step architecture planning walk (type → ASL → integration → Map → error handling → I/O → role → logging → Express → verification) |
Walk in order for every deployment |
| § Output format |
STATE_MACHINE_SPEC / VERDICT / ARCHITECTURE / CHECKLIST / FINDINGS / DEPLOY_COMMANDS template |
Format the response |
| § Verification commands |
Post-deploy CLI checks (describe, start-execution, CloudWatch) |
After create-state-machine returns |
| § Anti-Patterns |
NEVER list — common deployment mistakes (wildcard role, missing Retry, .sync on Lambda, Express > 5min) |
Review before concluding READY_TO_DEPLOY |
| § References |
Deeper docs on ASL states and Resource ARN patterns |
When you need the full integration catalog |
Quick reference — deployment checklist
| Dimension |
Requirement |
Step |
| Workflow type |
STANDARD (exactly-once, ≤1yr, $0.025/1k transitions) OR EXPRESS (at-least-once, ≤5min, $1.00/M invocations) — deliberate choice |
Step 1 |
| ASL definition |
Validated JSON; every Task has explicit TimeoutSeconds; StartAt chain reaches terminal state |
Step 2 |
| Service integrations |
Resource ARNs use correct suffix: bare (fire-and-forget), .sync (wait), .waitForTaskToken (callback) |
Step 3 |
| Sync vs callback |
.sync for run-to-completion (ECS, Glue, Athena); .waitForTaskToken for human/external approval |
Step 4 |
| Map state |
Inline (≤40 concurrent, ≤256KB input) OR Distributed (≤10000+ concurrent, S3/DynamoDB ItemReader, ItemBatcher) |
Step 5 |
| Error handling |
Every fallible Task has BOTH Retry (ErrorEquals, IntervalSeconds, MaxAttempts, BackoffRate) AND Catch (ErrorEquals, Next, ResultPath) |
Step 6 |
| I/O processing |
InputPath, ResultPath, OutputPath, Parameters used deliberately; payload < 256KB (Standard) / < 256KB (Express) |
Step 7 |
| IAM role |
Trust policy includes states.amazonaws.com; identity policy scoped to named actions on specific ARNs from the definition; no Action: "*" |
Step 8 |
| Logging (Express) |
LoggingConfiguration.level: ALL + includeExecutionData: true — the ONLY durable record for Express |
Step 9 |
| Tracing (Standard) |
TracingConfiguration.enabled: true + role grants xray:PutTraceSegments |
Step 9 |
| Express invocation mode |
Synchronous (RequestResponse — caller blocks ≤5min) vs Asynchronous (Firehose logging, caller gets exec ARN) |
Step 10 |
Pre-flight: deployment specification gate (run before architecture output)
Before producing the deployment plan, validate the input specification.
Several requirements block deployment — proceeding with an invalid spec
produces a non-functional or insecure state machine.
Live-account pre-flight checks (skip if doing offline architecture plan):
- Verify the caller has
states:CreateStateMachine,
states:ValidateStateMachineDefinition, iam:CreateRole,
iam:AttachRolePolicy, and iam:PassRole on the execution role ARN.
Surface IAM gaps BEFORE emitting deployment commands.
- Validate the ASL definition structure:
aws stepfunctions validate-state-machine-definition --definition file://def.json --type STANDARD
This catches syntax errors before the API reject at create-state-machine.
- Verify the execution role's trust policy includes
Principal: { Service: "states.amazonaws.com" } — CreateStateMachine
accepts any role ARN without validating trust, but the workflow fails on
first integration at runtime with AccessDenied.
- Check service quotas: Standard has no per-account execution cap; Express
has a soft account-level launch quota (default 100,000/sec, raisable).
| Attribute |
Value |
Effect on plan |
name |
Valid name ([a-zA-Z0-9-_]{1,80}) |
Required — CreateStateMachine rejects others |
type |
STANDARD |
Exactly-once, ≤1 year, per-transition billing. Default. |
type |
EXPRESS |
At-least-once, ≤5 min, per-invocation billing. Required for high-throughput event-driven workloads. |
definition |
Stringified ASL JSON |
API expects "{\"StartAt\":...}" — a STRING, not parsed object. Terraform/CloudFormation footgun. |
roleArn |
Existing role ARN with trust to states.amazonaws.com |
Required. If absent, emit PREREQUISITES_MISSING. |
loggingConfiguration |
For Express: level: ALL, includeExecutionData: true |
Mandatory for Express — execution history expires in minutes. |
tracingConfiguration |
For Standard: enabled: true |
Recommended — X-Ray only honored on Standard. |
If the deployment spec is incomplete (missing role ARN, missing workflow
type, or missing definition), output:
STATE_MACHINE_SPEC: <name-or-unknown>
VERDICT: PREREQUISITES_MISSING
REASON: Deployment specification is missing required fields (<list>).
Cannot produce a deployment plan without <field> — the resulting state
machine would be non-functional or insecure.
REQUIRED:
- name (1-80 chars, [a-zA-Z0-9-_])
- type (STANDARD or EXPRESS)
- definition (ASL JSON, stringified for the API)
- roleArn (existing role trusting states.amazonaws.com)
- loggingConfiguration (for EXPRESS: level ALL + includeExecutionData)
Process — Architecture planning (apply in order, produce deployment plan)
Step 0: Expert knowledge — non-obvious Step Functions behaviors that change the plan
Full detail moved verbatim to references/advanced-patterns.md - load on demand.
Summary: the complete Step 0 catalog of behaviors that change the deployment plan (billing, idempotency, history expiry, tracing no-op, timeouts, heartbeats, Retry/Catch, Map concurrency, .sync/.waitForTaskToken billing, definition-as-string, States.ALL gap, trust policy, SDK integrations, Bedrock, Redrive).
Step 1: Workflow type selection (STANDARD vs EXPRESS)
This is the single highest-leverage decision. Everything downstream
(error handling, logging, Map state, callback patterns) is constrained by
the type.
| Dimension |
STANDARD |
EXPRESS |
| Execution semantics |
Exactly-once |
At-least-once (Tasks MUST be idempotent) |
| Max duration |
1 year (31,536,000 seconds) |
5 minutes (300 seconds) |
| Billing |
$0.025 per 1,000 state transitions |
$1.00 per 1M invocations + GB-sec duration |
| Execution history |
90 days via API/console |
5 min (Synchronous) / 1 hour (Asynchronous) |
| X-Ray tracing |
Honored via TracingConfiguration |
NO-OP — use CloudWatch ServiceLens |
Callback (.waitForTaskToken) |
Supported, up to 1 year |
Supported, but capped at 5 min — practical only for fast external systems |
| Distributed Map child executions |
Billed per transition (parent + children) |
Billed per child invocation |
| Ideal workload |
Long saga, multi-step approval, batch with human steps |
High-volume event-driven (Kinesis/IoT/EventBridge fan-in), API Gateway sync backend |
Decision rule:
- If any Task can take > 5 minutes (Glue, Athena, ECS long task, human approval) → STANDARD.
- If the workload is high-volume (>1000 executions/sec) and each run is < 5 min → EXPRESS.
- If Tasks are non-idempotent and cannot be made idempotent → STANDARD.
- If the workload needs X-Ray distributed tracing → STANDARD.
- If unsure, default STANDARD; Express is a deliberate optimization for cost/throughput.
Step 2: ASL definition design
The Amazon States Language (ASL) defines the workflow as a JSON object
with StartAt, States, and terminal transitions. Each state has a
Type that determines its fields:
| State Type |
Purpose |
Required fields |
Common pitfalls |
Task |
Invoke a service integration |
Resource, Next (or End: true) |
Missing TimeoutSeconds (defaults 60s); missing Retry/Catch on fallible Resources |
Choice |
Branch on input |
Choices[], Default |
Missing Default is invalid ASL; StringEquals is case-sensitive |
Parallel |
Run branches concurrently |
Branches[], Next |
Errors in any branch fail the whole state; needs per-branch Catch |
Map |
Iterate over a collection |
Iterator, ItemsPath, MaxConcurrency |
Inline Map caps 40 concurrent; Distributed Map needs ItemReader |
Wait |
Pause for time/absolute time |
Seconds/SecondsPath/Timestamp/TimestampPath |
Standard only meaningful; Express caps total at 5 min |
Pass |
Transform input, no integration |
Result, ResultPath, Next |
Useful for scaffolding/Parameters construction |
Fail |
Terminal failure |
Error, Cause |
Cause is a static string — use Parameters-driven Pass before Fail for dynamic error context |
Succeed |
Terminal success |
(none) |
Clean exit |
Walk the definition before deploying:
- From
StartAt, follow Next / Default / Catch.Next — every path
must reach a terminal (End: true or a Fail/Succeed).
- Flag any unreachable state (no inbound transition).
- Flag any cycle with no exit (a
Task.Next to itself with no
Retry/Catch that can break out).
- Verify every
Task has an explicit TimeoutSeconds (no silent 60s
default).
- Verify every fallible
Task has at least one Retry AND at least
one Catch.
Step 3: Service integrations — Resource ARN patterns
Full detail moved verbatim to references/service-integration-patterns.md - load on demand.
Summary: the full Resource ARN pattern catalog and suffix decision tree.
Step 4: Sync vs callback pattern selection
Full detail moved verbatim to references/service-integration-patterns.md - load on demand.
Summary: the .sync vs .waitForTaskToken selection detail with anti-pattern.
Step 5: Map state design (Inline vs Distributed)
Full detail moved verbatim to references/asl-states-reference.md - load on demand.
Summary: the Inline-vs-Distributed comparison and both full ASL templates.
Step 6: Error handling — Retry and Catch
Full detail moved verbatim to references/error-handling.md - load on demand.
Summary: the complete Retry/Catch field reference and standard JSON shape.
Step 7: Input/output processing
ASL provides four fields on every state for input/output shaping:
| Field |
Operates on |
Direction |
Common use |
InputPath |
The state's input JSON |
Inbound — filters input before Parameters |
Strip irrelevant fields before processing |
Parameters |
Static template + .$ JSONPath values |
Inbound — constructs the integration input |
Build the integration's request body from the workflow input |
ResultPath |
The state's output JSON |
Outbound — controls where the integration's result is merged |
Preserve original input alongside result: "$.result" |
OutputPath |
The state's output JSON |
Outbound — filters after ResultPath |
Select a sub-field of the result to pass forward |
Pipeline order (apply left-to-right):
stateInput → InputPath → Parameters → [integration] → ResultSelector → ResultPath → OutputPath → stateOutput
Common pattern: pass-through with enriched output:
"Task": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"FunctionName": "Enrich",
"Payload.$": "$"
},
"ResultPath": "$.enriched",
"OutputPath": "$",
"Next": "NextState"
}
Payload size limits: 256KB for the workflow execution input AND each
state's input/output. For larger payloads, use S3 references (pass the S3
URI in the payload, fetch in the next Task) or use Distributed Map.
Step 8: IAM execution role (least privilege)
Full detail moved verbatim to references/iam-and-logging-templates.md - load on demand.
Summary: the trust policy, identity-policy derivation, and per-integration permission templates.
Step 9: Logging and tracing
Full detail moved verbatim to references/iam-and-logging-templates.md - load on demand.
Summary: the Express logging and Standard tracing configuration templates.
Step 10: Express invocation mode
Express workflows have TWO invocation modes, set at StartExecution time:
| Mode |
Caller experience |
Use case |
Synchronous (RequestResponse) |
Caller blocks until completion or 5-min cap; response includes final output |
API Gateway backend, real-time request/response |
Asynchronous |
Caller gets execution ARN immediately; result via CloudWatch Logs / EventBridge |
High-volume fan-in (Kinesis, IoT, EventBridge) |
For Synchronous Express, StartExecution is called via the
sync-execution API endpoint. Errors in any state return directly to the
caller as the HTTP response. Set Express-Sync workflows' StartAt Task's
TimeoutSeconds well under 5 minutes — the 5-min cap is a hard wall.
For Asynchronous Express, configure EventBridge to emit on
Step Functions Execution Status Change for downstream alerting.
Output format (per state machine deployment plan)
STATE_MACHINE_SPEC: <name>
VERDICT: READY_TO_DEPLOY | PREREQUISITES_MISSING
ARCHITECTURE:
Name: <name>
Type: STANDARD | EXPRESS
Definition: <StartAt + state count + terminal states>
Service integrations:
- <Resource ARN pattern 1> — <integration semantics>
- <Resource ARN pattern 2> — <integration semantics>
Map states:
- Inline: <count> (max concurrency <N>)
- Distributed: <count> (max concurrency <N>, source <S3|DynamoDB|payload>)
Error handling:
- <N> Tasks with Retry + Catch
- <N> Tasks without Retry (non-fallible or Pass states)
IAM role:
- Trust: states.amazonaws.com (verified)
- Identity policy: <N> statements, scoped to <list of ARN patterns>
Logging (Express): level=ALL, includeExecutionData=true → CloudWatch Logs
Tracing (Standard): enabled=true → X-Ray
CHECKLIST:
[x] Workflow type chosen deliberately (Standard vs Express)
[x] ASL definition validated — every path reaches a terminal
[x] Every fallible Task has Retry AND Catch
[x] Every Task has explicit TimeoutSeconds
[x] Resource ARN suffixes match desired semantics (bare / .sync / .waitForTaskToken)
[x] Map MaxConcurrency is set (not default 0/unbounded)
[x] IAM role scoped to named actions on specific ARNs
[x] Trust policy includes states.amazonaws.com
[x] Express: LoggingConfiguration level=ALL + includeExecutionData=true
[x] Standard: TracingConfiguration enabled=true + role has xray:PutTraceSegments
FINDINGS:
- [INFO] Estimated monthly cost: <breakdown>
- [WARN] <any non-blocking concerns>
DEPLOY_COMMANDS:
<ordered list of aws stepfunctions create-* and aws iam * commands>
Worked example — Express sync Lambda + DynamoDB workflow
STATE_MACHINE_SPEC: order-checkout-express
VERDICT: READY_TO_DEPLOY
ARCHITECTURE:
Name: order-checkout-express
Type: EXPRESS
Definition: StartAt=ValidateCart, 5 states (ValidateCart, ChargePayment,
ReserveInventory, UpdateOrderRecord, Succeed), 1 Catch handler
(PaymentErrorHandler). All paths reach a terminal.
Service integrations:
- arn:aws:states:::lambda:invoke (ValidateCart, ChargePayment,
ReserveInventory) — fire-and-forget Lambda
- arn:aws:states:::aws-sdk:dynamodb:updateItem (UpdateOrderRecord) —
direct DynamoDB UpdateItem, no Lambda
Map states: none
Error handling:
- ChargePayment: Retry on Lambda.ServiceException (2s, 3 attempts,
2.0 backoff) + Catch States.ALL → PaymentErrorHandler
- ReserveInventory: Retry on Lambda.ServiceException (2s, 3 attempts,
2.0 backoff)
- UpdateOrderRecord: Retry on DynamoDB.ProvisionedThroughputExceededException
(5s, 5 attempts, 2.0 backoff)
IAM role:
- Trust: states.amazonaws.com (verified)
- Identity policy: lambda:InvokeFunction on 3 specific function ARNs;
dynamodb:UpdateItem on OrdersTable ARN; logs:* on log group ARN
Logging: level=ALL, includeExecutionData=true → CloudWatch Logs
(/aws/states/order-checkout-express)
Tracing: N/A (Express — TracingConfiguration is no-op; ServiceLens
provides partial visibility)
CHECKLIST:
[x] Workflow type: EXPRESS — high-volume API Gateway backend, <5min total
[x] ASL definition validated — all paths reach Succeed or Fail
[x] Every fallible Task has Retry AND Catch (ChargePayment, ReserveInventory,
UpdateOrderRecord)
[x] Every Task has explicit TimeoutSeconds (30, 60, 30 respectively)
[x] Resource ARNs: bare lambda:invoke (already sync), aws-sdk dynamodb
[x] IAM role scoped to 3 Lambda ARNs + 1 DynamoDB table
[x] Trust policy: states.amazonaws.com verified
[x] Express Logging: level=ALL + includeExecutionData=true
FINDINGS:
- [INFO] Estimated cost at 10M invocations/day @ 100ms avg: $10/day
invocation + ~$5/day GB-sec = ~$15/day (~$450/month)
- [INFO] Idempotency: ChargePayment Lambda must be idempotent (Express
at-least-once semantics) — verify the function uses an idempotency key
- [WARN] Express sync via API Gateway: total workflow must complete in
< 29s (API Gateway 30s timeout) — current longest path is ~10s
DEPLOY_COMMANDS:
1. aws iam create-role --role-name order-checkout-sfn-role
--assume-role-policy-document file://trust-policy.json
2. aws iam put-role-policy --role-name order-checkout-sfn-role
--policy-name Scoped --policy-document file://identity-policy.json
3. aws stepfunctions validate-state-machine-definition
--definition file://definition.json --type EXPRESS
4. aws logs create-log-group --log-group-name /aws/states/order-checkout-express
5. aws stepfunctions create-state-machine
--name order-checkout-express --definition file://definition.json
--type EXPRESS --role-arn arn:aws:iam::111111111111:role/order-checkout-sfn-role
--logging-configuration level=ALL,includeExecutionData=true
--log-configuration-destinations cloudWatchLogsLogGroupArn=arn:aws:logs:us-east-1:111111111111:log-group:/aws/states/order-checkout-express:*
Verification commands (run after deployment)
Full detail moved verbatim to references/diagnostic-commands.md - load on demand.
Summary: the full post-deployment verification CLI listing.
Anti-Patterns — NEVER
NEVER choose Express for a workflow with any Task that can run > 5 min
(Glue job, Athena query, ECS long task, human approval). Express caps
total execution at 5 minutes — the Task will be killed mid-run.
NEVER use .waitForTaskToken on Express for human approval. The 5-min
cap fails the Task before any human responds. Use Standard for
callback-driven approval flows.
NEVER deploy a fallible Task (Lambda, DynamoDB, SQS, ECS, Glue) without
BOTH Retry AND Catch. ASL does NOT auto-retry — the first transient
error (Lambda.ServiceException,
DynamoDB.ProvisionedThroughputExceededException) fails the entire
execution.
NEVER deploy a Task without an explicit TimeoutSeconds. The default
is 60 seconds. Lambda functions configured for longer runtimes are
silently killed at 60s — the Lambda continues executing (and billing)
while Step Functions advances to States.Timeout.
NEVER use Action: "*" on the execution role. This is
admin-equivalent — one compromised state machine = full account
compromise. Scope to named actions on specific ARNs derived from the
definition.
NEVER use AdministratorAccess or AmazonStepFunctionsFullAccess as
the execution role's managed policy. These grant states:* on *,
enabling the workflow to chain into any other state machine in the
account (the Step Functions analogue of sts:AssumeRole).
NEVER grant states:StartExecution on Resource: "*" unless you
intend the workflow to chain into any sibling. This is the
chaining/escalation vector — scope to specific state machine ARNs.
NEVER forget the trust policy on the execution role.
CreateStateMachine accepts any role ARN — the trust policy is NOT
validated at creation. A role missing states.amazonaws.com fails
silently at runtime on the first integration.
NEVER use MaxConcurrency: 0 (the default) on a Map iterating >100
items. Zero means unbounded — Step Functions invokes iterations as
fast as possible, overwhelming downstream services (Lambda concurrency,
DynamoDB throttling).
NEVER use an Inline Map for >1000 items or >256KB total payload. Use
Distributed Map. Inline Map caps at 40 concurrent iterations and 256KB.
NEVER assume TracingConfiguration.enabled: true produces X-Ray traces
on an Express workflow. The field is silently accepted but produces no
traces. Use Standard for X-Ray; use CloudWatch ServiceLens for Express.
NEVER assume States.ALL catches States.Timeout. On state machines
created before November 2022, States.ALL does NOT match
States.Timeout. Always list States.Timeout explicitly in Catch
for long-running workflows.
NEVER pass a parsed JSON object as the definition to
CreateStateMachine. The API expects a STRINGIFIED JSON
("{\"StartAt\": ...}"). Use jsonencode() in Terraform or proper
string escaping in CloudFormation.
NEVER use .sync on a Lambda integration. arn:aws:states:::lambda:invoke
is already synchronous — the .sync suffix is only meaningful for
async-launch services (ECS, Glue, Athena, SageMaker, Step Functions
nested).
NEVER build non-idempotent Tasks in an Express workflow. Express
at-least-once semantics means Tasks can be invoked MORE THAN ONCE on
internal failure. DynamoDB PutItem without a composite idempotency
key, SQS SendMessage without dedup, Stripe charge without
idempotency key — all produce duplicates on retry.
NEVER recommend deleting a state machine as a remediation step without
first verifying no in-flight executions exist. Standard executions can
run for up to 1 year; deleting the state machine orphans them.
NEVER forget that the execution role may be shared across multiple
state machines. Tightening the role for one workflow may break another.
Before put-role-policy, list dependents via
aws resourcegroupstaggingapi get-resources --resource-type-filters states:stateMachine.
Pre-flight safety checks (run before any deployment CLI)
Full detail moved verbatim to references/diagnostic-commands.md - load on demand.
Summary: the pre-deployment safety checklist and CLI listings.
Recent AWS features (2024-2026)
Full detail moved verbatim to references/advanced-patterns.md - load on demand.
Summary: the 2024-2026 feature list (Redrive, Distributed Map enhancements, SDK integrations, Bedrock, resource policies, payload validation, JSONata).
References
references/asl-states-reference.md — complete ASL state catalog
(Task, Choice, Parallel, Map, Wait, Pass, Fail, Succeed) with field
requirements, valid transitions, and worked examples per state type.
references/service-integration-patterns.md — exhaustive Resource ARN
catalog (Lambda, DynamoDB, SQS, SNS, ECS, SageMaker, Glue, Athena,
Bedrock, AWS SDK) with sync/callback variants, required IAM actions,
and integration-specific gotchas.
References (load on demand)
- references/advanced-patterns.md - Step 0 expert knowledge and recent AWS features
- references/error-handling.md - Retry/Catch design deep dive
- references/diagnostic-commands.md - post-deploy verification and pre-deploy safety CLI listings
- references/iam-and-logging-templates.md - IAM trust/identity policy and logging/tracing templates
- references/asl-states-reference.md - (existing) ASL state catalog; now also holds Map design and I/O processing detail
- references/service-integration-patterns.md - (existing) Resource ARN catalog; now also holds Steps 3-4 selection detail
Domain
AWS CloudOps / Step Functions Orchestration Provisioning.
AWS documentation
1---2name: stepfunctions-statemachine-deployer3description: Provisions production-grade AWS Step Functions state machines with correct type selection (Standard exactly-once up to 1 year vs Express at-least-once up to 5 min), Amazon States Language definitions (Task, Choice, Parallel, Map, Wait, Pass, Fail, Succeed), service integrations via Resource ARN patterns (Lambda, DynamoDB, SQS, SNS, ECS, SageMaker, Glue, Athena, Bedrock), sync (.sync) vs callback (.waitForTaskToken) invocation patterns, error handling (Retry with exponential backoff, Catch routing), Inline Map (40 concurrent) vs Distributed Map (10000+ concurrent with S3/DynamoDB ItemReader, ItemBatcher, toleratedFailurePercentage), IAM least-privilege execution role, input/output processing (InputPath, ResultPath, OutputPath, Parameters), Express sync (RequestResponse) vs async (Firehose logging) workflows, and AWS SDK service integrations for direct API calls without Lambda. Emits a READY_TO_DEPLOY checklist. Use when provisioning state machines, designing ASL workflows, configuring service.4license: Apache-2.05compatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). No AWS CLI required for offline architecture planning. Live deployment uses aws stepfunctions create-state-machine, update-state-machine, describe-state-machine, validate-state-machine-definition, start-execution, and aws iam create-role / attach-role-policy (AWS CLI v2, SSO or key-based credentials).6metadata:7 source: https://skillmd.com/skills/jhkchan/stepfunctions-statemachine-deployer8 domain: aws-cloudops9 complexity: high10 requires_llm: 'true'11 phase: '1'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: AppIntegration15 task_type: deploy16 skill_class: capability17 lifecycle_status: active18 verdict_shape: READY_TO_DEPLOY | PREREQUISITES_MISSING19 when_to_use: Provisioning a new Step Functions state machine, choosing between Standard and Express workflow types, designing an ASL definition with service integrations (Lambda, DynamoDB, SQS, ECS, Glue, Bedrock), configuring Retry/Catch error handling, building a Distributed Map for large-scale fan-out, scoping the IAM execution role to specific resource ARNs, choosing between sync (.sync) and callback (.waitForTaskToken) integration patterns, or hardening an Express workflow for production.20 activation_triggers: create a state machine, deploy Step Functions workflow, Standard vs Express workflow, write ASL definition, service integration Resource ARN, Retry and Catch blocks, Distributed Map state, waitForTaskToken callback, Step Functions execution role, Step Functions + Lambda orchestration, Step Functions + Bedrock, Express workflow synchronous21 invocation_schema: 'Input shape (one of): (a) a deployment specification including workflow name, type (STANDARD | EXPRESS), ASL definition (or requirements to derive one), service integrations, error-handling requirements, and execution role scope; (b) a partial spec for interactive refinement (e.g., "Express workflow invoking Lambda + DynamoDB, sync, 60s budget"); (c) an existing state machine ARN for architecture review against the well-architected checklist. Output shape: { STATE_MACHINE_SPEC, VERDICT, ARCHITECTURE, CHECKLIST[], FINDINGS[], DEPLOY_COMMANDS } where VERDICT ∈ { READY_TO_DEPLOY, PREREQUISITES_MISSING, ERROR }.'22 version: 0.1.023 author: Jacky Chan — AWS Community Builder24 keywords: Step Functions, state machine, ASL, Amazon States Language, Standard workflow, Express workflow, Task state, Choice state, Parallel state, Map state, Distributed Map, Inline Map, Retry, Catch, error handling, service integration, Resource ARN, waitForTaskToken, sync integration, callback pattern, Task Token, IAM execution role, states:StartExecution, InputPath, ResultPath, OutputPath, Parameters, ItemReader, ItemBatcher, Bedrock invocation, AWS SDK integration, Step Functions Playground25 tags: stepfunctions, app-integration, deploy, state-machine, asl, express, standard, distributed-map, service-integration, iam, error-handling26---2728# Step Functions State Machine Deployer2930## Mindset3132**One-line takeaway:** a production state machine is not "a JSON definition33plus a role" — it is an **orchestration contract** where the workflow type,34the service integration pattern, the error-handling semantics, and the IAM35role scope must each be a deliberate decision. The ASL syntax is the least36interesting part; the **type semantics, integration pattern, and Retry/Catch37shape** determine cost, durability, and blast radius.3839Three facts make Step Functions provisioning different from "write a JSON":4041- **Workflow type is a durability + cost decision, not a syntax decision.**42 Standard workflows bill per state transition ($0.025 per 1,000); Express43 workflows bill per invocation + duration ($1.00 per million invocations).44 Standard guarantees exactly-once execution semantics and supports runs up45 to 1 year. Express is at-least-once and caps at 5 minutes. A high-volume46 event-driven workload on Standard can balloon cost 100x versus Express; a47 long-running compensation saga on Express is impossible — the 5-minute cap48 kills it. Type is decided FIRST, before any ASL is written.4950- **The Resource ARN suffix selects the integration semantics, not the51 service.** `arn:aws:states:::lambda:invoke` fires-and-forgets;52 `arn:aws:states:::lambda:invoke.sync` does not exist (Lambda is already53 sync); `arn:aws:states:::ecs:runTask.sync` waits for the task to complete;54 `arn:aws:states:::sqs:sendMessage.waitForTaskToken` pauses the workflow55 until an external worker calls `SendTaskSuccess`. Getting the suffix wrong56 produces either silent fire-and-forget bugs or stuck executions.5758- **A fallible Task without Retry AND Catch fails the entire execution on59 the first transient error.** ASL does NOT auto-retry. Lambda60 `ServiceException`, DynamoDB `ProvisionedThroughputExceededException`, and61 ECS `CapacityProviderInsufficientCapacity` are all transient — without an62 explicit `Retry` block, the workflow dies and must be re-run from the top63 (Standard) or lost entirely (Express async). Production Tasks require64 BOTH `Retry` (for transient errors) and `Catch` (for terminal fallback).6566## Quick navigation6768| Section | What it covers | When to read it |69|---|---|---|70| **§ Quick reference** | Dimension → requirement table (type, ASL, integration, error handling, role, observability) | Identify which dimensions your spec touches |71| **§ Pre-flight** | Required inputs gate (role ARN, type, definition) — blocks on missing | Before producing any plan |72| **§ Process** | Ten-step architecture planning walk (type → ASL → integration → Map → error handling → I/O → role → logging → Express → verification) | Walk in order for every deployment |73| **§ Output format** | STATE_MACHINE_SPEC / VERDICT / ARCHITECTURE / CHECKLIST / FINDINGS / DEPLOY_COMMANDS template | Format the response |74| **§ Verification commands** | Post-deploy CLI checks (describe, start-execution, CloudWatch) | After `create-state-machine` returns |75| **§ Anti-Patterns** | NEVER list — common deployment mistakes (wildcard role, missing Retry, .sync on Lambda, Express > 5min) | Review before concluding READY_TO_DEPLOY |76| **§ References** | Deeper docs on ASL states and Resource ARN patterns | When you need the full integration catalog |7778## Quick reference — deployment checklist7980| Dimension | Requirement | Step |81|---|---|---|82| Workflow type | STANDARD (exactly-once, ≤1yr, $0.025/1k transitions) OR EXPRESS (at-least-once, ≤5min, $1.00/M invocations) — deliberate choice | Step 1 |83| ASL definition | Validated JSON; every Task has explicit `TimeoutSeconds`; StartAt chain reaches terminal state | Step 2 |84| Service integrations | Resource ARNs use correct suffix: bare (fire-and-forget), `.sync` (wait), `.waitForTaskToken` (callback) | Step 3 |85| Sync vs callback | `.sync` for run-to-completion (ECS, Glue, Athena); `.waitForTaskToken` for human/external approval | Step 4 |86| Map state | Inline (≤40 concurrent, ≤256KB input) OR Distributed (≤10000+ concurrent, S3/DynamoDB ItemReader, ItemBatcher) | Step 5 |87| Error handling | Every fallible Task has BOTH `Retry` (ErrorEquals, IntervalSeconds, MaxAttempts, BackoffRate) AND `Catch` (ErrorEquals, Next, ResultPath) | Step 6 |88| I/O processing | InputPath, ResultPath, OutputPath, Parameters used deliberately; payload < 256KB (Standard) / < 256KB (Express) | Step 7 |89| IAM role | Trust policy includes `states.amazonaws.com`; identity policy scoped to named actions on specific ARNs from the definition; no `Action: "*"` | Step 8 |90| Logging (Express) | `LoggingConfiguration.level: ALL` + `includeExecutionData: true` — the ONLY durable record for Express | Step 9 |91| Tracing (Standard) | `TracingConfiguration.enabled: true` + role grants `xray:PutTraceSegments` | Step 9 |92| Express invocation mode | `Synchronous` (RequestResponse — caller blocks ≤5min) vs `Asynchronous` (Firehose logging, caller gets exec ARN) | Step 10 |9394## Pre-flight: deployment specification gate (run before architecture output)9596Before producing the deployment plan, validate the input specification.97Several requirements **block deployment** — proceeding with an invalid spec98produces a non-functional or insecure state machine.99100**Live-account pre-flight checks (skip if doing offline architecture plan):**1011. Verify the caller has `states:CreateStateMachine`,102 `states:ValidateStateMachineDefinition`, `iam:CreateRole`,103 `iam:AttachRolePolicy`, and `iam:PassRole` on the execution role ARN.104 Surface IAM gaps BEFORE emitting deployment commands.1052. Validate the ASL definition structure:106 `aws stepfunctions validate-state-machine-definition --definition file://def.json --type STANDARD`107 This catches syntax errors before the API reject at `create-state-machine`.1083. Verify the execution role's trust policy includes109 `Principal: { Service: "states.amazonaws.com" }` — `CreateStateMachine`110 accepts any role ARN without validating trust, but the workflow fails on111 first integration at runtime with `AccessDenied`.1124. Check service quotas: Standard has no per-account execution cap; Express113 has a soft account-level launch quota (default 100,000/sec, raisable).114115| Attribute | Value | Effect on plan |116|---|---|---|117| `name` | Valid name (`[a-zA-Z0-9-_]{1,80}`) | Required — `CreateStateMachine` rejects others |118| `type` | `STANDARD` | Exactly-once, ≤1 year, per-transition billing. Default. |119| `type` | `EXPRESS` | At-least-once, ≤5 min, per-invocation billing. Required for high-throughput event-driven workloads. |120| `definition` | Stringified ASL JSON | API expects `"{\"StartAt\":...}"` — a STRING, not parsed object. Terraform/CloudFormation footgun. |121| `roleArn` | Existing role ARN with trust to `states.amazonaws.com` | Required. If absent, emit PREREQUISITES_MISSING. |122| `loggingConfiguration` | For Express: `level: ALL`, `includeExecutionData: true` | Mandatory for Express — execution history expires in minutes. |123| `tracingConfiguration` | For Standard: `enabled: true` | Recommended — X-Ray only honored on Standard. |124125**If the deployment spec is incomplete** (missing role ARN, missing workflow126type, or missing definition), output:127128```text129STATE_MACHINE_SPEC: <name-or-unknown>130VERDICT: PREREQUISITES_MISSING131REASON: Deployment specification is missing required fields (<list>).132Cannot produce a deployment plan without <field> — the resulting state133machine would be non-functional or insecure.134REQUIRED:135 - name (1-80 chars, [a-zA-Z0-9-_])136 - type (STANDARD or EXPRESS)137 - definition (ASL JSON, stringified for the API)138 - roleArn (existing role trusting states.amazonaws.com)139 - loggingConfiguration (for EXPRESS: level ALL + includeExecutionData)140```141142## Process — Architecture planning (apply in order, produce deployment plan)143144### Step 0: Expert knowledge — non-obvious Step Functions behaviors that change the plan145146> Full detail moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) - load on demand.147> Summary: the complete Step 0 catalog of behaviors that change the deployment plan (billing, idempotency, history expiry, tracing no-op, timeouts, heartbeats, Retry/Catch, Map concurrency, .sync/.waitForTaskToken billing, definition-as-string, States.ALL gap, trust policy, SDK integrations, Bedrock, Redrive).148149### Step 1: Workflow type selection (STANDARD vs EXPRESS)150151This is the single highest-leverage decision. Everything downstream152(error handling, logging, Map state, callback patterns) is constrained by153the type.154155| Dimension | STANDARD | EXPRESS |156|---|---|---|157| Execution semantics | Exactly-once | At-least-once (Tasks MUST be idempotent) |158| Max duration | 1 year (31,536,000 seconds) | 5 minutes (300 seconds) |159| Billing | $0.025 per 1,000 state transitions | $1.00 per 1M invocations + GB-sec duration |160| Execution history | 90 days via API/console | 5 min (Synchronous) / 1 hour (Asynchronous) |161| X-Ray tracing | Honored via `TracingConfiguration` | NO-OP — use CloudWatch ServiceLens |162| Callback (`.waitForTaskToken`) | Supported, up to 1 year | Supported, but capped at 5 min — practical only for fast external systems |163| Distributed Map child executions | Billed per transition (parent + children) | Billed per child invocation |164| Ideal workload | Long saga, multi-step approval, batch with human steps | High-volume event-driven (Kinesis/IoT/EventBridge fan-in), API Gateway sync backend |165166**Decision rule:**167- If any Task can take > 5 minutes (Glue, Athena, ECS long task, human approval) → STANDARD.168- If the workload is high-volume (>1000 executions/sec) and each run is < 5 min → EXPRESS.169- If Tasks are non-idempotent and cannot be made idempotent → STANDARD.170- If the workload needs X-Ray distributed tracing → STANDARD.171- If unsure, default STANDARD; Express is a deliberate optimization for cost/throughput.172173### Step 2: ASL definition design174175The Amazon States Language (ASL) defines the workflow as a JSON object176with `StartAt`, `States`, and terminal transitions. Each state has a177`Type` that determines its fields:178179| State Type | Purpose | Required fields | Common pitfalls |180|---|---|---|---|181| `Task` | Invoke a service integration | `Resource`, `Next` (or `End: true`) | Missing `TimeoutSeconds` (defaults 60s); missing `Retry`/`Catch` on fallible Resources |182| `Choice` | Branch on input | `Choices[]`, `Default` | Missing `Default` is invalid ASL; `StringEquals` is case-sensitive |183| `Parallel` | Run branches concurrently | `Branches[]`, `Next` | Errors in any branch fail the whole state; needs per-branch Catch |184| `Map` | Iterate over a collection | `Iterator`, `ItemsPath`, `MaxConcurrency` | Inline Map caps 40 concurrent; Distributed Map needs `ItemReader` |185| `Wait` | Pause for time/absolute time | `Seconds`/`SecondsPath`/`Timestamp`/`TimestampPath` | Standard only meaningful; Express caps total at 5 min |186| `Pass` | Transform input, no integration | `Result`, `ResultPath`, `Next` | Useful for scaffolding/Parameters construction |187| `Fail` | Terminal failure | `Error`, `Cause` | `Cause` is a static string — use `Parameters`-driven Pass before Fail for dynamic error context |188| `Succeed` | Terminal success | (none) | Clean exit |189190**Walk the definition before deploying:**1911. From `StartAt`, follow `Next` / `Default` / `Catch.Next` — every path192 must reach a terminal (`End: true` or a `Fail`/`Succeed`).1932. Flag any unreachable state (no inbound transition).1943. Flag any cycle with no exit (a `Task.Next` to itself with no195 `Retry`/`Catch` that can break out).1964. Verify every `Task` has an explicit `TimeoutSeconds` (no silent 60s197 default).1985. Verify every fallible `Task` has at least one `Retry` AND at least199 one `Catch`.200201### Step 3: Service integrations — Resource ARN patterns202203> Full detail moved verbatim to [references/service-integration-patterns.md](references/service-integration-patterns.md) - load on demand.204> Summary: the full Resource ARN pattern catalog and suffix decision tree.205206### Step 4: Sync vs callback pattern selection207208> Full detail moved verbatim to [references/service-integration-patterns.md](references/service-integration-patterns.md) - load on demand.209> Summary: the .sync vs .waitForTaskToken selection detail with anti-pattern.210211### Step 5: Map state design (Inline vs Distributed)212213> Full detail moved verbatim to [references/asl-states-reference.md](references/asl-states-reference.md) - load on demand.214> Summary: the Inline-vs-Distributed comparison and both full ASL templates.215216### Step 6: Error handling — Retry and Catch217218> Full detail moved verbatim to [references/error-handling.md](references/error-handling.md) - load on demand.219> Summary: the complete Retry/Catch field reference and standard JSON shape.220221### Step 7: Input/output processing222223ASL provides four fields on every state for input/output shaping:224225| Field | Operates on | Direction | Common use |226|---|---|---|---|227| `InputPath` | The state's input JSON | Inbound — filters input before `Parameters` | Strip irrelevant fields before processing |228| `Parameters` | Static template + `.$` JSONPath values | Inbound — constructs the integration input | Build the integration's request body from the workflow input |229| `ResultPath` | The state's output JSON | Outbound — controls where the integration's result is merged | Preserve original input alongside result: `"$.result"` |230| `OutputPath` | The state's output JSON | Outbound — filters after `ResultPath` | Select a sub-field of the result to pass forward |231232**Pipeline order (apply left-to-right):**233`stateInput → InputPath → Parameters → [integration] → ResultSelector → ResultPath → OutputPath → stateOutput`234235**Common pattern: pass-through with enriched output:**236```json237"Task": {238 "Type": "Task",239 "Resource": "arn:aws:states:::lambda:invoke",240 "Parameters": {241 "FunctionName": "Enrich",242 "Payload.$": "$"243 },244 "ResultPath": "$.enriched",245 "OutputPath": "$",246 "Next": "NextState"247}248```249250**Payload size limits:** 256KB for the workflow execution input AND each251state's input/output. For larger payloads, use S3 references (pass the S3252URI in the payload, fetch in the next Task) or use Distributed Map.253254### Step 8: IAM execution role (least privilege)255256> Full detail moved verbatim to [references/iam-and-logging-templates.md](references/iam-and-logging-templates.md) - load on demand.257> Summary: the trust policy, identity-policy derivation, and per-integration permission templates.258259### Step 9: Logging and tracing260261> Full detail moved verbatim to [references/iam-and-logging-templates.md](references/iam-and-logging-templates.md) - load on demand.262> Summary: the Express logging and Standard tracing configuration templates.263264### Step 10: Express invocation mode265266Express workflows have TWO invocation modes, set at `StartExecution` time:267268| Mode | Caller experience | Use case |269|---|---|---|270| `Synchronous` (RequestResponse) | Caller blocks until completion or 5-min cap; response includes final output | API Gateway backend, real-time request/response |271| `Asynchronous` | Caller gets execution ARN immediately; result via CloudWatch Logs / EventBridge | High-volume fan-in (Kinesis, IoT, EventBridge) |272273For Synchronous Express, `StartExecution` is called via the274`sync-execution` API endpoint. Errors in any state return directly to the275caller as the HTTP response. Set Express-Sync workflows' `StartAt` Task's276`TimeoutSeconds` well under 5 minutes — the 5-min cap is a hard wall.277278For Asynchronous Express, configure EventBridge to emit on279`Step Functions Execution Status Change` for downstream alerting.280281## Output format (per state machine deployment plan)282283```text284STATE_MACHINE_SPEC: <name>285VERDICT: READY_TO_DEPLOY | PREREQUISITES_MISSING286ARCHITECTURE:287 Name: <name>288 Type: STANDARD | EXPRESS289 Definition: <StartAt + state count + terminal states>290 Service integrations:291 - <Resource ARN pattern 1> — <integration semantics>292 - <Resource ARN pattern 2> — <integration semantics>293 Map states:294 - Inline: <count> (max concurrency <N>)295 - Distributed: <count> (max concurrency <N>, source <S3|DynamoDB|payload>)296 Error handling:297 - <N> Tasks with Retry + Catch298 - <N> Tasks without Retry (non-fallible or Pass states)299 IAM role:300 - Trust: states.amazonaws.com (verified)301 - Identity policy: <N> statements, scoped to <list of ARN patterns>302 Logging (Express): level=ALL, includeExecutionData=true → CloudWatch Logs303 Tracing (Standard): enabled=true → X-Ray304CHECKLIST:305 [x] Workflow type chosen deliberately (Standard vs Express)306 [x] ASL definition validated — every path reaches a terminal307 [x] Every fallible Task has Retry AND Catch308 [x] Every Task has explicit TimeoutSeconds309 [x] Resource ARN suffixes match desired semantics (bare / .sync / .waitForTaskToken)310 [x] Map MaxConcurrency is set (not default 0/unbounded)311 [x] IAM role scoped to named actions on specific ARNs312 [x] Trust policy includes states.amazonaws.com313 [x] Express: LoggingConfiguration level=ALL + includeExecutionData=true314 [x] Standard: TracingConfiguration enabled=true + role has xray:PutTraceSegments315FINDINGS:316 - [INFO] Estimated monthly cost: <breakdown>317 - [WARN] <any non-blocking concerns>318DEPLOY_COMMANDS:319 <ordered list of aws stepfunctions create-* and aws iam * commands>320```321322### Worked example — Express sync Lambda + DynamoDB workflow323324```text325STATE_MACHINE_SPEC: order-checkout-express326VERDICT: READY_TO_DEPLOY327ARCHITECTURE:328 Name: order-checkout-express329 Type: EXPRESS330 Definition: StartAt=ValidateCart, 5 states (ValidateCart, ChargePayment,331 ReserveInventory, UpdateOrderRecord, Succeed), 1 Catch handler332 (PaymentErrorHandler). All paths reach a terminal.333 Service integrations:334 - arn:aws:states:::lambda:invoke (ValidateCart, ChargePayment,335 ReserveInventory) — fire-and-forget Lambda336 - arn:aws:states:::aws-sdk:dynamodb:updateItem (UpdateOrderRecord) —337 direct DynamoDB UpdateItem, no Lambda338 Map states: none339 Error handling:340 - ChargePayment: Retry on Lambda.ServiceException (2s, 3 attempts,341 2.0 backoff) + Catch States.ALL → PaymentErrorHandler342 - ReserveInventory: Retry on Lambda.ServiceException (2s, 3 attempts,343 2.0 backoff)344 - UpdateOrderRecord: Retry on DynamoDB.ProvisionedThroughputExceededException345 (5s, 5 attempts, 2.0 backoff)346 IAM role:347 - Trust: states.amazonaws.com (verified)348 - Identity policy: lambda:InvokeFunction on 3 specific function ARNs;349 dynamodb:UpdateItem on OrdersTable ARN; logs:* on log group ARN350 Logging: level=ALL, includeExecutionData=true → CloudWatch Logs351 (/aws/states/order-checkout-express)352 Tracing: N/A (Express — TracingConfiguration is no-op; ServiceLens353 provides partial visibility)354CHECKLIST:355 [x] Workflow type: EXPRESS — high-volume API Gateway backend, <5min total356 [x] ASL definition validated — all paths reach Succeed or Fail357 [x] Every fallible Task has Retry AND Catch (ChargePayment, ReserveInventory,358 UpdateOrderRecord)359 [x] Every Task has explicit TimeoutSeconds (30, 60, 30 respectively)360 [x] Resource ARNs: bare lambda:invoke (already sync), aws-sdk dynamodb361 [x] IAM role scoped to 3 Lambda ARNs + 1 DynamoDB table362 [x] Trust policy: states.amazonaws.com verified363 [x] Express Logging: level=ALL + includeExecutionData=true364FINDINGS:365 - [INFO] Estimated cost at 10M invocations/day @ 100ms avg: $10/day366 invocation + ~$5/day GB-sec = ~$15/day (~$450/month)367 - [INFO] Idempotency: ChargePayment Lambda must be idempotent (Express368 at-least-once semantics) — verify the function uses an idempotency key369 - [WARN] Express sync via API Gateway: total workflow must complete in370 < 29s (API Gateway 30s timeout) — current longest path is ~10s371DEPLOY_COMMANDS:372 1. aws iam create-role --role-name order-checkout-sfn-role373 --assume-role-policy-document file://trust-policy.json374 2. aws iam put-role-policy --role-name order-checkout-sfn-role375 --policy-name Scoped --policy-document file://identity-policy.json376 3. aws stepfunctions validate-state-machine-definition377 --definition file://definition.json --type EXPRESS378 4. aws logs create-log-group --log-group-name /aws/states/order-checkout-express379 5. aws stepfunctions create-state-machine380 --name order-checkout-express --definition file://definition.json381 --type EXPRESS --role-arn arn:aws:iam::111111111111:role/order-checkout-sfn-role382 --logging-configuration level=ALL,includeExecutionData=true383 --log-configuration-destinations cloudWatchLogsLogGroupArn=arn:aws:logs:us-east-1:111111111111:log-group:/aws/states/order-checkout-express:*384```385386## Verification commands (run after deployment)387388> Full detail moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md) - load on demand.389> Summary: the full post-deployment verification CLI listing.390391## Anti-Patterns — NEVER392393- NEVER choose Express for a workflow with any Task that can run > 5 min394 (Glue job, Athena query, ECS long task, human approval). Express caps395 total execution at 5 minutes — the Task will be killed mid-run.396397- NEVER use `.waitForTaskToken` on Express for human approval. The 5-min398 cap fails the Task before any human responds. Use Standard for399 callback-driven approval flows.400401- NEVER deploy a fallible Task (Lambda, DynamoDB, SQS, ECS, Glue) without402 BOTH `Retry` AND `Catch`. ASL does NOT auto-retry — the first transient403 error (`Lambda.ServiceException`,404 `DynamoDB.ProvisionedThroughputExceededException`) fails the entire405 execution.406407- NEVER deploy a Task without an explicit `TimeoutSeconds`. The default408 is 60 seconds. Lambda functions configured for longer runtimes are409 silently killed at 60s — the Lambda continues executing (and billing)410 while Step Functions advances to `States.Timeout`.411412- NEVER use `Action: "*"` on the execution role. This is413 admin-equivalent — one compromised state machine = full account414 compromise. Scope to named actions on specific ARNs derived from the415 definition.416417- NEVER use `AdministratorAccess` or `AmazonStepFunctionsFullAccess` as418 the execution role's managed policy. These grant `states:*` on `*`,419 enabling the workflow to chain into any other state machine in the420 account (the Step Functions analogue of `sts:AssumeRole`).421422- NEVER grant `states:StartExecution` on `Resource: "*"` unless you423 intend the workflow to chain into any sibling. This is the424 chaining/escalation vector — scope to specific state machine ARNs.425426- NEVER forget the trust policy on the execution role.427 `CreateStateMachine` accepts any role ARN — the trust policy is NOT428 validated at creation. A role missing `states.amazonaws.com` fails429 silently at runtime on the first integration.430431- NEVER use `MaxConcurrency: 0` (the default) on a Map iterating >100432 items. Zero means unbounded — Step Functions invokes iterations as433 fast as possible, overwhelming downstream services (Lambda concurrency,434 DynamoDB throttling).435436- NEVER use an Inline Map for >1000 items or >256KB total payload. Use437 Distributed Map. Inline Map caps at 40 concurrent iterations and 256KB.438439- NEVER assume `TracingConfiguration.enabled: true` produces X-Ray traces440 on an Express workflow. The field is silently accepted but produces no441 traces. Use Standard for X-Ray; use CloudWatch ServiceLens for Express.442443- NEVER assume `States.ALL` catches `States.Timeout`. On state machines444 created before November 2022, `States.ALL` does NOT match445 `States.Timeout`. Always list `States.Timeout` explicitly in `Catch`446 for long-running workflows.447448- NEVER pass a parsed JSON object as the `definition` to449 `CreateStateMachine`. The API expects a STRINGIFIED JSON450 (`"{\"StartAt\": ...}"`). Use `jsonencode()` in Terraform or proper451 string escaping in CloudFormation.452453- NEVER use `.sync` on a Lambda integration. `arn:aws:states:::lambda:invoke`454 is already synchronous — the `.sync` suffix is only meaningful for455 async-launch services (ECS, Glue, Athena, SageMaker, Step Functions456 nested).457458- NEVER build non-idempotent Tasks in an Express workflow. Express459 at-least-once semantics means Tasks can be invoked MORE THAN ONCE on460 internal failure. DynamoDB `PutItem` without a composite idempotency461 key, SQS SendMessage without dedup, Stripe charge without462 idempotency key — all produce duplicates on retry.463464- NEVER recommend deleting a state machine as a remediation step without465 first verifying no in-flight executions exist. Standard executions can466 run for up to 1 year; deleting the state machine orphans them.467468- NEVER forget that the execution role may be shared across multiple469 state machines. Tightening the role for one workflow may break another.470 Before `put-role-policy`, list dependents via471 `aws resourcegroupstaggingapi get-resources --resource-type-filters states:stateMachine`.472473## Pre-flight safety checks (run before any deployment CLI)474475> Full detail moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md) - load on demand.476> Summary: the pre-deployment safety checklist and CLI listings.477478## Recent AWS features (2024-2026)479480> Full detail moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) - load on demand.481> Summary: the 2024-2026 feature list (Redrive, Distributed Map enhancements, SDK integrations, Bedrock, resource policies, payload validation, JSONata).482483## References484485- `references/asl-states-reference.md` — complete ASL state catalog486 (Task, Choice, Parallel, Map, Wait, Pass, Fail, Succeed) with field487 requirements, valid transitions, and worked examples per state type.488- `references/service-integration-patterns.md` — exhaustive Resource ARN489 catalog (Lambda, DynamoDB, SQS, SNS, ECS, SageMaker, Glue, Athena,490 Bedrock, AWS SDK) with sync/callback variants, required IAM actions,491 and integration-specific gotchas.492493## References (load on demand)494495- [references/advanced-patterns.md](references/advanced-patterns.md) - Step 0 expert knowledge and recent AWS features496- [references/error-handling.md](references/error-handling.md) - Retry/Catch design deep dive497- [references/diagnostic-commands.md](references/diagnostic-commands.md) - post-deploy verification and pre-deploy safety CLI listings498- [references/iam-and-logging-templates.md](references/iam-and-logging-templates.md) - IAM trust/identity policy and logging/tracing templates499- [references/asl-states-reference.md](references/asl-states-reference.md) - (existing) ASL state catalog; now also holds Map design and I/O processing detail500- [references/service-integration-patterns.md](references/service-integration-patterns.md) - (existing) Resource ARN catalog; now also holds Steps 3-4 selection detail501502## Domain503504AWS CloudOps / Step Functions Orchestration Provisioning.505506## AWS documentation507508- **AWS Step Functions Developer Guide** — https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html509- **Amazon States Language spec** — https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html510- **Service integrations** — https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-services.html511- **Distributed Map** — https://docs.aws.amazon.com/step-functions/latest/dg/concepts-asl-use-map-state-distributed.html512- **Step Functions API Reference** — https://docs.aws.amazon.com/step-functions/latest/apireference/513- **Step Functions CLI Reference** — https://docs.aws.amazon.com/cli/latest/reference/stepfunctions/514- **Standard vs Express** — https://docs.aws.amazon.com/step-functions/latest/dg/concepts-standard-vs-express.html