I want the Lambda function to be triggered every 10 minutes and the function to receive an event in the form of JSON from EventBridge. The event will contain a Document ID which will be used in the Lambda code. Currently, the EventBridge does not have the feature to send custom events to target for Rule Type Schedule. The custom event here is the Document ID which I want the Lambda function to receive as an event. How can I achieve this?
Asked
Active
Viewed 1.1k times
4
-
What do you mean by "EventBridge is not allowing to send custom events for Rule Type Schedule"? What do you consider to be a "custom event"? When you say that you want the Lambda function to receive an event, what event do you want it to receive? Please Edit your question to add these additional details, rather than answering via a comment. – John Rotenstein Mar 21 '22 at 05:19
-
@JohnRotenstein thank you for the suggestions. Added details to the question – user18333852 Mar 21 '22 at 05:26
-
Are you saying that you would like to invoke an AWS Lambda function every 10 minutes and you would like to pass specific information in the `event` that will be received by the Lambda function? Will this information be static (that is, the same every time that the function is invoked), or will it change each time (in which case, where does that data come from)? – John Rotenstein Mar 21 '22 at 05:28
-
Yes, I would like to invoke an AWS Lambda function every 10 minutes and pass static information in the event that will be received by the Lambda function. – user18333852 Mar 21 '22 at 05:31
1 Answers
11
It appears that your goal is:
- Trigger an AWS Lambda function every n minutes
- Pass static information in the event that will be received by the Lambda function
You can do this when configuring the target for a scheduled event:
- Select the Lambda function as a target
- In Additional Settings select "Configure target input" and Constant (JSON text)
The event will then be available in the Lambda function via the event
parameter:

John Rotenstein
- 241,921
- 22
- 380
- 470
-
Any chance you know the pattern to accomplish the same via CloudFormation? I am can trigger a lambda regularly via a `AWS::Events::Rule` w/ a `ScheduleExpression` pattern but am unclear on how to include a constant JSON as shown above. Was hoping the [docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html#cfn-events-rule-state) would help here, but perhaps am missing something obvious. – kuanb Oct 06 '22 at 01:47
-
I think it would use the `Input` field in [AWS::Events::Rule Target](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-input), which is referenced from [AWS::Events::Rule](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html). – John Rotenstein Oct 06 '22 at 02:09
-
-
@PedroHenrique The above documentation page for `Rule Target` shows a YAML example that references `Input`. – John Rotenstein Oct 25 '22 at 03:45