Pass Events to lambda through eventrule

0

Usually, in lambda, I used to use the events, where I used to trigger the lambda manually. Later on, the eventrule(cronjob) is used to trigger the lambda automatically. But the events in the lambda aren't accepting, rather the events from the eventrule are passed into lambda. How can I pass events to a lambda that is been triggered through eventrule(cronjob).

1 Answer
1

What event do you want to pass to Lambda when invoked from the scheduled rule? The schedule itself is the event in this case.

profile pictureAWS
EXPERT
Uri
answered 9 months ago
  • I have my own custom event in lambda as the below. { "fromadd": "developer@gmail.com", "frompass": "adcdefghikj", "mongousers": [ { "dbusername": "admintestuser", "dbpass": "Password321", "email": "admintest@gmail.com" } ] } But I'm unable to pass these since the eventbridge overwrites the events to lambda

  • First, I am guessing that you want to send the same information in each invocation. In this case I would use environment variables to store these values, or better yet, store the names of parameters in Secretes Manager or SSM.

    Second, if you still prefer to send these value in the event, and if you are using scheduled rules (consider moving to EventBridge Scheduler), when you set up the rule, you can choose in the Additional Settings section in the console to send a constant JSON. If you are using the EB Scheduler, when you configure the schedule, you need to specify the payload that will be sent to the function.

  • Hey, thanks Uri. I chose the Additional Settings section in the EventBridge Scheduler to send a constant JSON and I was able to pass in the json.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions