AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: This pattern is a Lambda function asynchronously triggered by a Lambda Function. Resources: ProducerFunction: Type: AWS::Serverless::Function Description: Lambda Function that will trigger Destination Function onSuccess or onFailure Properties: CodeUri: ProducerFunction/ Handler: app.handler Runtime: nodejs12.x Timeout: 3 EventInvokeConfig: DestinationConfig: OnFailure: Type: Lambda Destination: !GetAtt OnFailureFunction.Arn # Arn of a Lambda function declared in the template file. OnSuccess: Type: Lambda Destination: !GetAtt OnSuccessFunction.Arn # Arn of a Lambda function declared in the template file. OnFailureFunction: Type: AWS::Serverless::Function Description: Invoked by ProducerFunction Lambda onFailure Properties: CodeUri: OnFailureFunction/ Handler: app.handler Runtime: nodejs12.x Timeout: 3 OnSuccessFunction: Type: AWS::Serverless::Function Description: Invoked by ProducerFunction Lambda onSuccess Properties: CodeUri: OnSuccessFunction/ Handler: app.handler Runtime: nodejs12.x Timeout: 3 Outputs: ProducerFunctionName: Description: Producer Lambda Function Name Value: !Ref ProducerFunction # Arn of Lambda function declared in the template file. ProducerFunctionARN: Description: Producer Lambda Function ARN Value: !GetAtt ProducerFunction.Arn # Arn of Lambda function declared in the template file. OnSuccessFunctionName: Description: OnSuccess Lambda Function Name Value: !Ref OnSuccessFunction # Arn of Lambda function declared in the template file. OnSuccessFunctionARN: Description: OnSuccess Lambda Function ARN Value: !GetAtt OnSuccessFunction.Arn # Arn of Lambda function declared in the template file. OnFailureFunctionName: Description: OnFailure Lambda Function Name Value: !Ref OnFailureFunction # Arn of Lambda function declared in the template file. OnFailureFunctionARN: Description: OnFailure Lambda Function ARN Value: !GetAtt OnFailureFunction.Arn # Arn of Lambda function declared in the template file.