Study guide
Technical reference and lesson notes
Purpose of This Lesson
AWS Step Functions is a serverless workflow orchestration service. It coordinates a sequence of states that can perform processing, make decisions, wait, run tasks in parallel, or terminate successfully or unsuccessfully.
This lesson demonstrates how to create and execute a simple state machine using the AWS Management Console and Amazon States Language.
Key Concepts
State machines
A state machine is a workflow definition. It describes:
- The starting state
- The states that make up the workflow
- Transitions between states
- Conditions that determine the next state
- How the workflow ends
State machines can be created from scratch, based on AWS-provided templates, or from an example such as the Hello World workflow.
Executions
An execution is a single run of a state machine. The Step Functions console provides a visual execution history so you can inspect the progression of the workflow and identify which states ran.
A single state machine can have many executions over time. The definition describes the workflow; each execution represents one instance of that workflow processing input.
Amazon States Language
State machines are defined using Amazon States Language, commonly represented as JSON. The definition specifies the workflow structure and state behavior.
A simplified example is:
{
"StartAt": "ValidateInput",
"States": {
"ValidateInput": {
"Type": "Pass",
"Next": "Complete"
},
"Complete": {
"Type": "Succeed"
}
}
}
The visual workflow editor and the code editor represent the same state machine definition in different ways. Definitions can also be imported when a workflow has already been authored as Amazon States Language.
Common state types shown in the example
#### Pass state
A Pass state performs no external work. It can pass input to the next state and is useful for:
- Testing workflow transitions
- Providing placeholder processing
- Injecting or transforming simple data in a workflow definition
- Building a workflow skeleton before adding real tasks
#### Choice state
A Choice state evaluates conditions and selects one of multiple branches. The example uses a Boolean condition that leads to a yes or no path.
Choice states are useful when workflow behavior depends on input or the result of an earlier task, such as routing a request based on validation, status, or business rules.
#### Wait state
A Wait state pauses workflow execution for a configured period or until a specified time. It is useful when a process must delay before checking a condition, polling for an external result, or continuing to a later stage.
#### Parallel state
A Parallel state runs multiple branches as part of the same workflow. It is appropriate when independent activities can proceed concurrently rather than sequentially.
The workflow continues after the parallel branches complete, subject to the behavior defined in the state machine.
#### Succeed and Fail states
Terminal states end an execution explicitly:
Succeedmarks the execution as successful.Failmarks the execution as failed and can provide error and cause details.
A workflow can use these states after decision branches or validation steps to make the final outcome explicit.
Task processing
The demonstration workflow contains structural states and does not perform meaningful business processing. In a production state machine, a task state can invoke or coordinate work such as:
- An AWS Lambda function
- An AWS service integration
- An activity or other supported Step Functions integration
This separation allows Step Functions to orchestrate work without requiring the workflow itself to contain the application logic.
Exam-Relevant Takeaways
- AWS Step Functions provides visual, serverless orchestration for multi-step workflows.
- A state machine is the workflow definition; an execution is one run of that definition.
- Amazon States Language is used to define state machines and is commonly written in JSON.
Passis useful for testing or passing data without invoking external processing.Choicecreates conditional branches.Waitintroduces a delay or waits until a configured time.Parallelexecutes independent branches concurrently.SucceedandFailexplicitly terminate an execution.- A workflow can combine orchestration states with task states that invoke Lambda or integrate with other AWS services.
- The Step Functions console supports visual authoring, code-based editing, templates, and execution inspection.
Architecture Decision Guide
| Requirement | Step Functions feature or state | Design consideration |
|---|---|---|
| Model a workflow visually | State machine and Workflow Studio/editor | Useful for understanding transitions and troubleshooting execution paths |
| Pass through data or create a placeholder step | Pass | Does not perform application work by itself |
| Route execution based on input or a previous result | Choice | Define conditions and provide an appropriate default path where needed |
| Delay processing or poll later | Wait | Avoid unnecessary compute while the workflow is paused |
| Run independent operations concurrently | Parallel | Use when branches are independent and can safely execute at the same time |
| Mark a workflow as complete | Succeed | Explicit successful terminal state |
| Mark a workflow as unsuccessful | Fail | Explicit failed terminal state; include useful failure context |
| Invoke application logic | Task state, such as Lambda integration | Keep business logic in the task and orchestration logic in Step Functions |
| Inspect a workflow run | Execution history and visual graph | Review state transitions and failures for operational troubleshooting |
| Reuse an existing workflow definition | Amazon States Language import | Validate the JSON definition and required integrations before deployment |
Common Exam Traps
- Confusing a state machine with an execution: The state machine is reusable; an execution is a particular run.
- Assuming every state performs work:
Pass,Choice,Wait,Succeed, andFailprimarily control workflow behavior. Application processing generally belongs in a task or service integration. - Treating
Choiceas parallel processing:Choiceselects a branch.Parallelruns multiple branches. - Using a delay mechanism unnecessarily: A
Waitstate can pause a workflow without keeping a compute resource continuously running. - Assuming the visual editor is a separate workflow language: The visual representation and code view describe the same Amazon States Language definition.
- Ignoring terminal paths: Every possible branch should eventually reach an appropriate next state or terminal state.
- Using a placeholder workflow as production logic: A Hello World or template state machine demonstrates structure but does not necessarily implement real application behavior.
Real-World Engineer Notes
- Start with the workflow’s state transitions and failure paths before adding application-specific tasks.
- Use meaningful state names so execution histories are understandable during incident analysis.
- Keep orchestration decisions in Step Functions and domain processing in Lambda or integrated AWS services.
- Use
Choicestates for explicit business routing rather than embedding all control flow inside one Lambda function. - Use
Parallelonly when branches are genuinely independent and their completion behavior is acceptable for the workflow. - Test state transitions with representative input, including values that exercise every choice branch and failure path.
- Treat the state machine definition as deployable infrastructure. Store it in source control, review changes, and deploy consistently across environments.
Quick Reference Summary
- Service: AWS Step Functions
- Primary purpose: Serverless workflow orchestration
- Workflow definition: State machine
- Workflow run: Execution
- Definition language: Amazon States Language, commonly JSON
- Conditional routing:
Choice - Delay:
Wait - Concurrent branches:
Parallel - Placeholder or pass-through:
Pass - Successful termination:
Succeed - Failed termination:
Fail - Application work: Task states and AWS service integrations
Flashcards
- Q: What is an AWS Step Functions state machine?
A: A definition of a workflow, including its states, transitions, conditions, and terminal outcomes.
- Q: What is an execution?
A: One run or instance of a state machine.
- Q: What language defines Step Functions workflows?
A: Amazon States Language, commonly expressed in JSON.
- Q: What does a
Passstate do?
A: It passes input through the workflow without performing external processing and is useful for testing or placeholders.
- Q: Which state selects a path based on conditions?
A: Choice.
- Q: Which state pauses workflow execution?
A: Wait.
- Q: Which state runs multiple branches concurrently?
A: Parallel.
- Q: What is the difference between
SucceedandFail?
A: Succeed ends the execution successfully; Fail ends it unsuccessfully.
- Q: Where does business processing typically occur in a Step Functions workflow?
A: In task states that invoke Lambda functions or integrate with AWS services.
- Q: What does the Step Functions execution view provide?
A: A visual representation and history of the states traversed during a particular execution.
Practice Questions
Question 1
A solutions architect is designing a workflow that validates an input, routes valid and invalid requests differently, and then ends each route with an explicit outcome. Which Step Functions states are most appropriate?
A. Parallel, followed by two Wait states
B. Choice, followed by Succeed or Fail
C. Pass, followed by Parallel only
D. Wait, followed by Choice and no terminal state
Correct answer: B
Explanation: A Choice state evaluates the validation result and selects a branch. Succeed and Fail explicitly represent the final outcomes.
Question 2
A workflow needs to start two independent processing activities at the same time and continue after both branches finish. Which state should be used?
A. Choice
B. Wait
C. Parallel
D. Pass
Correct answer: C
Explanation: A Parallel state runs multiple branches concurrently. Choice selects one path, while Wait delays execution and Pass does not perform concurrent processing.
Question 3
A team wants to test state transitions before implementing the Lambda functions that will eventually perform the business operations. Which state is most useful as a placeholder?
A. Pass
B. Fail
C. Parallel
D. Wait
Correct answer: A
Explanation: A Pass state can represent a workflow step without invoking external processing, making it useful for building and testing the workflow structure.
Question 4
A developer edits a Step Functions workflow in the visual console and then views its JSON representation. What does the JSON represent?
A. A separate Lambda deployment package
B. An Amazon States Language definition of the same state machine
C. A CloudFormation-only template
D. An execution log that cannot be imported
Correct answer: B
Explanation: Step Functions state machines are defined using Amazon States Language. The visual editor and code view represent the same workflow definition, which can also be imported when authored externally.
Question 5
A workflow must pause before checking whether an external process has completed. The architect wants to avoid keeping a compute function running during the delay. Which Step Functions capability addresses this requirement?
A. Wait state
B. Pass state
C. Choice state only
D. Succeed state
Correct answer: A
Explanation: A Wait state pauses the workflow for a configured duration or until a specified time, allowing the workflow to delay without continuously running application compute.