Exams / DVA-C02 / Orchestration with Step Functions / Question 1
DVA-C02 practice question: Orchestration with Step Functions
Development with AWS Services A free question from our original DVA-C02 practice exam. Try it, then open the answer to see why each option is right or wrong.
A Step Functions Task state calls a payment Lambda function. The function sometimes throws a custom error named GatewayTimeout. The developer has added this to the state:
"Retry": [{
"ErrorEquals": ["GatewayTimeout"],
"IntervalSeconds": 2,
"MaxAttempts": 3,
"BackoffRate": 2
}]
If the call still fails after the retries, the workflow must go to a state named NotifyFailure and keep the original input. What should the developer add?
Choose one answer.
- AA. A Catch field with ErrorEquals ["GatewayTimeout"], ResultPath "$.error" and Next "NotifyFailure".
- BB. A second retrier with ErrorEquals ["States.ALL"] and Next set to "NotifyFailure".
- CC. A Catch field with ErrorEquals ["GatewayTimeout"] and Next "NotifyFailure", without ResultPath.
- DD. An on-failure destination on the Lambda function that points to the NotifyFailure state.
Show the answer and explanation
Answer: A
- A. Right: Correct. Catch runs once the retrier is exhausted, Next sends the execution to NotifyFailure, and ResultPath adds the error to the input instead of replacing it.
- B. Wrong: Retriers have no Next field. Only a catcher can move the execution to another state.
- C. Wrong: This reaches the right state, but the default ResultPath of $ replaces the whole input with the error output.
- D. Wrong: Lambda destinations apply to asynchronous invocations and cannot target a state inside a workflow.
Explanation
Step Functions evaluates Retry first and applies a matching Catch only after retries are exhausted. A catcher needs ErrorEquals and Next. By default its ResultPath is $, which overwrites the input with the error, so setting ResultPath to a path such as $.error keeps the original input and adds the error details.
Study
Keep practising
Answer questions with a score at the end, or practise just this topic with the explanation after each one. No sign-up needed.