Which solution will meet these requirements?
Configure a Lambda function destination with a failure condition. Specify Lambda function as the destination type. Specify the error-handling Lambda function’s Amazon Resource Name (ARN) as the resource.
Enable AWS X-Ray active tracing on the initial Lambda function. Configure X-Ray to capture stack traces of the failed invocations. Invoke the error-handling Lambda function by including the stack traces in the event object.
Configure a Lambda function trigger with a failure condition. Specify Lambda function as the destination type. Specify the error-handling Lambda function’s Amazon Resource Name (ARN) as the resource.
Create a status check alarm on the initial Lambda function. Configure the alarm to invoke the error-handling Lambda function when the alarm is initiated. Ensure that the alarm passes the stack trace in the event object.
Explanations:
Configuring a Lambda function destination with a failure condition allows you to specify another Lambda function to handle failed invocations directly. This setup ensures that whenever the initial Lambda function fails, the error-handling function is automatically invoked, making it the most suitable solution for the requirement.
Enabling AWS X-Ray active tracing captures stack traces of failed invocations, but it does not automatically invoke a second Lambda function. This approach is primarily for monitoring and debugging rather than handling errors directly, which does not meet the requirement.
Lambda function triggers do not exist in the context described. While you can set up triggers for synchronous invocations, the question specifically addresses asynchronous failures, which are best handled through destinations rather than triggers. This makes this option incorrect.
Creating a status check alarm on the initial Lambda function does not directly relate to handling failed invocations. Alarms are primarily used for monitoring and alerting rather than for immediate invocation of another function based on invocation failures. Additionally, alarms do not provide the granularity needed for handling specific invocation errors.