Search code examples
amazon-web-servicesaws-lambdaserverlessaws-event-bridge

AWS EventBridge - Use output of first target as input to the next


A rule in AWS EventBridge allows us to provide upto 5 targets. For each of these targets, we have some options to choose the input - based on the event that matched the rule. Is there a way to pass the output of the first target (lambda function) as the input to the next (another lambda function).

I know we can do this by triggering an SNS at the end of the first lambda function. But, I am looking for a way to do this within the EventBridge.

Thanks for your help


Solution

  • A cleaner way to do this would be to have Eventbridge hand over the event to a Step Functions state machine and have 5 steps in that state machine.

    Step functions allow you to consume output from first step in the second step and so on.

    More on Step Functions here.

    More on Lambda with Step Functions here.