I am using serverless framework and the AWS Node.js SDK for adding scheduled cron expression based rule to default event bus.
eventBridge.putRule(params, function (err, data) {...
After that I add target to this rule.
const params = {
Rule: data.ruleName,
Targets: [
{
Arn: process.env.SCHEDULED_EVENT_LAMBDA_ARN, /* required */
Id: process.env.SCHEDULED_EVENT_LAMBDA_ID, /* required */
Input: JSON.stringify(someData)
},
],
};
eventBridge.putTargets(params, function (err, data) {...
adding target is successful on the dynamically created scheduled cron rule on event bridge but when I navigate to lambda dashboard it does not seems like the triggering layer is updated and eventually the lambda function is not triggered.
The AWS SDK documentation for event bridge putTargets is mentioning:
For AWS Lambda and Amazon SNS resources, EventBridge relies on resource-based policies
So if the resource policy is the issue(not confirmed) is there any configuration regarding resource policy which I can set in serverless.yml file for a specific function that allows event-bridge service to add layer to deployed targated lambda function.