Search code examples
javaaws-lambdaaws-event-bridge

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.


Solution

  • If you use scheduled-events to trigger a lambda function then you should be able to use InputTransformer to add whatever static data you want to have delivered to the lambda (see: https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-transform-target-input.html)