How can the developer implement the Lambda retry functionality without adding unnecessary complexity to the state machine?
Add a Delay task after the GetResource task. Add a catcher to the GetResource task. Configure the catcher with an error type of TooManyRequestsException. Configure the next step to be the Delay task. Configure the Delay task to wait for an interval of 10 seconds. Configure the next step to be the GetResource task.
Add a catcher to the GetResource task. Configure the catcher with an error type of TooManyRequestsException, an interval of 10 seconds, and a maximum attempts value of 1. Configure the next step to be the GetResource task.
Add a retrier to the GetResource task. Configure the retrier with an error type of TooManyRequestsException, an interval of 10 seconds, and a maximum attempts value of 1.
Duplicate the GetResource task. Rename the new GetResource task to TryAgain. Add a catcher to the original GetResource task. Configure the catcher with an error type of TooManyRequestsException. Configure the next step to be TryAgain.
Explanations:
This option introduces unnecessary complexity by adding a Delay task after the GetResource task. The Delay task does not effectively manage retries since it would only delay the next attempt without managing the error handling logic directly within the state machine’s error handling configuration. The catcher’s next step should ideally lead back to the GetResource task without requiring an additional Delay task, which can be avoided.
Although this option suggests a catcher for the TooManyRequestsException, it incorrectly configures the next step to be the GetResource task. This approach does not manage retries effectively, as it does not utilize the retrier functionality, which is designed for retry logic within the task itself. The state machine will attempt the GetResource task again without waiting, which is not what the developer wants.
This option correctly implements the required retry functionality by adding a retrier to the GetResource task. It specifies the error type (TooManyRequestsException), an interval of 10 seconds, and a maximum of 1 retry attempt. This configuration allows the state machine to wait before retrying the task if it encounters a TooManyRequestsException, effectively handling the retry logic without unnecessary complexity. If the retry fails, the state machine will stop running, which meets the developer’s requirements.
This option suggests duplicating the GetResource task and using a catcher, which unnecessarily complicates the state machine. While it does provide a way to handle the TooManyRequestsException, having two separate tasks increases maintenance overhead and does not take advantage of the built-in retry capabilities of AWS Step Functions. This approach is less efficient and more difficult to manage compared to using a retrier directly on the original GetResource task.