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).

已提問 10 個月前檢視次數 212 次
1 個回答
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
專家
Uri
已回答 10 個月前
  • 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.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南