SAA-C03 Question 162
Single answerA company is building a serverless application that processes incoming customer orders. The application uses an AWS Lambda function to validate the orders, a second Lambda function to charge the customer, and a third Lambda function to notify the fulfillment team. Each function must execute in sequence, and if any function fails, the workflow should stop and log the error. The company wants to minimize custom code for managing the workflow. Which solution should the company choose?
- A
Use AWS Step Functions to orchestrate the Lambda functions in a sequential workflow.
- B
Create an Amazon SQS queue and use it to trigger the Lambda functions in sequence.
- C
Use Amazon EventBridge to invoke the Lambda functions in order, with custom retry logic for failures.
- D
Write custom code in the first Lambda function to call the second and third Lambda functions sequentially.
Show answer and explanation
Correct answer: A
Explanation
AWS Step Functions is the best choice for orchestrating workflows that involve multiple tasks (such as Lambda functions) in a sequence. It provides built-in capabilities for error handling, retries, and state management, reducing the need for custom code. Other options like SQS or EventBridge are not designed for sequential workflows, and writing custom orchestration code increases complexity unnecessarily.
- A. Correct.
This is the correct answer. AWS Step Functions is designed for workflow orchestration and allows you to execute tasks (such as Lambda functions) in a specific sequence. Step Functions also provides native error handling, retries, and state management, which simplifies the implementation.
- B. Incorrect.
This is incorrect. While you can use Amazon SQS for event-driven processing, it does not natively support sequential execution of tasks or handle errors and retries in the same way AWS Step Functions does.
- C. Incorrect.
This is incorrect. Amazon EventBridge is event-driven and does not natively provide sequential task execution or error handling as required in this scenario.
- D. Incorrect.
This is incorrect. Writing custom code to manage the workflow increases complexity and operational burden. AWS Step Functions is a better solution for this use case since it avoids the need to write and maintain custom orchestration logic.