Question #858
A developer is using AWS Step Functions to orchestrate a serverless workflow that includes multiple AWS Lambda functions. One of the Lambda functions experiences throttling errors when there's a sudden spike in traffic. The developer needs to ensure that the workflow automatically retries the failed function invocation when a throttling error occurs. Which solution meets this requirement?
Add a Retry field in the Step Functions state machine definition, configuring it to retry on the Throttled error type with a maximum number of attempts.
Add a Throttle field in the Step Functions state machine definition, setting the maximum retry attempts.
Modify the Lambda function's configuration to increase its concurrency limit and set up a Dead Letter Queue for failed invocations.
Update the state machine to route throttled invocations to an Amazon SQS queue and configure a Lambda function to process messages from the queue with retries.
Explanation
Answer A is correct because AWS Step Functions natively supports error handling via the Retry field in the state machine definition. By configuring this field to target the Throttled error type and specifying a maximum number of attempts, the workflow will automatically retry the failed Lambda invocation when throttling occurs. This approach aligns with Step Functions' built-in error-handling capabilities.
Why other options are incorrect:
- B: There is no Throttle field in Step Functions; the correct field is Retry.
- C: Increasing Lambda's concurrency limit addresses throttling capacity but does not enable automatic retries within the workflow. A Dead Letter Queue (DLQ) captures failed events but does not retry them.
- D: While Amazon SQS can manage retries, this adds unnecessary complexity. Step Functions can handle retries natively without routing to SQS.
Key Takeaway: Step Functions' Retry policy is the standard way to handle transient errors (like throttling) in serverless workflows, ensuring simplicity and adherence to AWS best practices.
Answer
The correct answer is: A