I have Amazon MQ in AWS account A. I want to set this Amazon MQ as a trigger for a lambda function in account B. Lambda does not currently support cross-account triggering for Amazon MQ. How can i do this?
Configure Amazon MQ as trigger for lambda function
2
Answers
When there is no direct support, one needs to build a solution using components that are at their disposal.
Since the end goal is to trigger a lambda function, one option that I can think of is copying the messages from Amazon MQ message broker to AWS SQS as an SQS Queue can be used to trigger a lambda function in another account (assuming that the security policies allow).
For the purpose of copying, there has to be something consuming the MQ broker – another lambda perhaps!
Cross-account triggering for Amazon MQ to Lambda directly is not supported out of the box. However, you can set up a mechanism to achieve this by combining a few AWS services. Here’s a step-by-step solution:
Amazon MQ in Account A:
AWS Lambda in Account B:
Intermediate Service:
Solution using SNS:
Solution using EventBridge:
This approach allows you to trigger a Lambda function in Account B based on messages in Amazon MQ in Account A, even though it’s not a direct integration.