Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass custom parameters in Event Bridge schedule event to lambda

I have a Lambda function which gets invoked at a fixed schedule from EventBridge events. Is there any way to pass custom parameters(like a json file) to the invoked lambda function via an event rule?

I tried passing a json string inside withEventPattern in the PutRule object, like this:

{'detail': {"id" : ["unique_id"]}} => this lead to this error:

"Event pattern is not valid. Reason: Unrecognized match type instance-id\n at [Source: (String)\"{\"detail\":[{\"instance-id\":[\"d1983a77-dc0e-4724-953f-df283c1ad421\"]}]}\"

I understand this is not the appropriate way of doing this, but I was trying my luck.

like image 928
Hououin Kyouma Avatar asked Sep 03 '25 03:09

Hououin Kyouma


1 Answers

When you create the EventBridge rule, you can specify JSON to pass for the event. Under "Additional settings" you can configure the target input, and one option is JSON. The following shows this in the console, and similar options are available if you create the rule via the APIs or CloudFormation: json example

like image 121
Shawn Avatar answered Sep 04 '25 16:09

Shawn