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.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则