Bird
Raised Fist0
AWScloud~20 mins

Step Functions for workflows in AWS - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Step Functions Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ service_behavior
intermediate
2:00remaining
What happens when a Step Function state fails without a retry?

Consider an AWS Step Function with a state that fails and has no retry configured. What is the behavior of the workflow?

AThe entire workflow immediately fails and stops execution.
BThe workflow retries the failed state automatically three times.
CThe workflow ignores the failure and continues to the next state.
DThe workflow pauses and waits for manual intervention.
Attempts:
2 left
💡 Hint

Think about what happens if no retry or catch is set for a failing state.

❓ Architecture
intermediate
2:00remaining
Which Step Function state type is best for running a Lambda function asynchronously?

You want to run an AWS Lambda function asynchronously within a Step Function workflow. Which state type should you use?

AChoice state directing to Lambda.
BWait state before calling Lambda.
CPass state with Lambda ARN.
DTask state with 'InvocationType' set to 'Event'.
Attempts:
2 left
💡 Hint

Consider how to invoke Lambda asynchronously in Step Functions.

❓ security
advanced
2:30remaining
How to securely pass sensitive data to a Step Function without exposing it in logs?

You need to pass sensitive information (like passwords) to a Step Function execution but want to avoid exposing it in CloudWatch logs. What is the best practice?

AStore sensitive data in AWS Secrets Manager and reference it in the Step Function using parameters.
BInclude sensitive data directly in the input JSON of the Step Function execution.
CEncrypt sensitive data manually and pass as plain text in input.
DSend sensitive data as environment variables in Lambda functions only.
Attempts:
2 left
💡 Hint

Think about AWS services designed for secrets management and integration with Step Functions.

❓ Configuration
advanced
2:00remaining
What is the effect of setting 'HeartbeatSeconds' in a Task state?

In an AWS Step Function Task state, you set 'HeartbeatSeconds' to 30. What happens if the task does not send a heartbeat within 30 seconds?

AThe Step Function pauses and waits indefinitely.
BThe task automatically retries without failure.
CThe Step Function marks the task as failed due to timeout.
DThe task continues running without interruption.
Attempts:
2 left
💡 Hint

HeartbeatSeconds is related to task health checks.

✅ Best Practice
expert
3:00remaining
How to design a Step Function workflow to handle partial failures and continue processing?

You have a Step Function workflow that processes multiple independent tasks. You want the workflow to continue even if some tasks fail, collecting success and failure results. Which design approach achieves this?

AUse Wait states between tasks to avoid failures.
BUse Parallel state with Catch blocks on each branch to handle failures and continue.
CUse Choice states to skip failed tasks without capturing errors.
DUse a single Task state without error handling; failures stop the workflow.
Attempts:
2 left
💡 Hint

Think about how to isolate failures in parallel branches.

Practice

(1/5)
1. What is the main purpose of AWS Step Functions in a workflow?
easy
A. To monitor network traffic between AWS services
B. To coordinate and manage the sequence of tasks in a workflow
C. To provide a user interface for AWS services
D. To store large amounts of data for applications

Solution

  1. Step 1: Understand the role of Step Functions

    AWS Step Functions help organize and control the order of tasks in a workflow, making sure each step runs in sequence or parallel as needed.
  2. Step 2: Compare with other AWS services

    Other options describe storage, UI, or monitoring, which are not the main functions of Step Functions.
  3. Final Answer:

    To coordinate and manage the sequence of tasks in a workflow -> Option B
  4. Quick Check:

    Step Functions = task coordination [OK]
Hint: Step Functions organize tasks step-by-step [OK]
Common Mistakes:
  • Confusing Step Functions with storage services
  • Thinking Step Functions provide UI
  • Assuming Step Functions monitor network traffic
2. Which JSON field is required to define a task state in an AWS Step Functions state machine?
easy
A. "Timeout" specifying the maximum execution time
B. "Retry" specifying the retry policy
C. "InputPath" specifying the input data format
D. "Resource" specifying the ARN of the task to run

Solution

  1. Step 1: Identify the key field for task execution

    The "Resource" field is mandatory in a task state to specify which AWS service or Lambda function to invoke.
  2. Step 2: Understand other fields

    "Timeout", "InputPath", and "Retry" are optional fields that control behavior but are not required to define a task.
  3. Final Answer:

    "Resource" specifying the ARN of the task to run -> Option D
  4. Quick Check:

    Task state needs "Resource" [OK]
Hint: "Resource" points to the task to run [OK]
Common Mistakes:
  • Confusing optional fields with required ones
  • Using "Timeout" as a required field
  • Forgetting to specify the task ARN
3. Given this Step Functions snippet, what is the next state after TaskA completes successfully?
{
  "StartAt": "TaskA",
  "States": {
    "TaskA": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:region:123456789012:function:FunctionA",
      "Next": "TaskB"
    },
    "TaskB": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:region:123456789012:function:FunctionB",
      "End": true
    }
  }
}
medium
A. TaskB
B. TaskA
C. End state
D. No next state defined

Solution

  1. Step 1: Read the "Next" field of TaskA

    The JSON shows "Next": "TaskB" for TaskA, meaning after TaskA finishes, the workflow moves to TaskB.
  2. Step 2: Confirm TaskB is defined

    TaskB is defined and marked with "End": true, so it is the final step after TaskA.
  3. Final Answer:

    TaskB -> Option A
  4. Quick Check:

    TaskA's "Next" = TaskB [OK]
Hint: Check the "Next" field for the following state [OK]
Common Mistakes:
  • Assuming TaskA loops to itself
  • Thinking workflow ends after TaskA
  • Ignoring the "Next" field
4. You have this Step Functions state definition:
{
  "Type": "Task",
  "Resource": "arn:aws:lambda:region:123456789012:function:MyFunction",
  "Next": "NextState"
}
What is missing that could cause a failure if the Lambda function errors?
medium
A. "Catch" block to handle errors
B. "TimeoutSeconds" field to limit execution time
C. "ResultPath" to store output
D. "StartAt" field to define the first state

Solution

  1. Step 1: Identify error handling in Step Functions

    Without a "Catch" block, errors from the Lambda function cause the workflow to fail immediately.
  2. Step 2: Understand other fields

    "TimeoutSeconds" limits time but is optional; "ResultPath" controls output storage; "StartAt" is for the state machine root, not individual states.
  3. Final Answer:

    "Catch" block to handle errors -> Option A
  4. Quick Check:

    Error handling needs "Catch" [OK]
Hint: Add "Catch" to handle task errors safely [OK]
Common Mistakes:
  • Confusing "TimeoutSeconds" with error handling
  • Omitting "Catch" causes workflow failure on error
  • Thinking "StartAt" is needed inside a task
5. You want to build a workflow that runs two Lambda functions in parallel and then proceeds only when both finish successfully. Which Step Functions state type should you use?
hard
A. Map state
B. Choice state
C. Parallel state
D. Pass state

Solution

  1. Step 1: Understand the requirement for parallel execution

    Running two Lambda functions at the same time and waiting for both to finish requires a "Parallel" state.
  2. Step 2: Review other state types

    "Choice" is for branching decisions, "Map" is for iterating over items, and "Pass" passes data without work.
  3. Final Answer:

    Parallel state -> Option C
  4. Quick Check:

    Parallel state runs tasks simultaneously [OK]
Hint: Use Parallel state to run tasks together [OK]
Common Mistakes:
  • Using Choice state for parallelism
  • Confusing Map state with parallel execution
  • Thinking Pass state runs tasks
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard