EventBridge Rule Target ID

0

There is drift detected in a CloudFormation template regarding the ID value of an EventBridge rule target, which is a Lambda function, i.e. Property: Targets.0.Id; Change: NOT_EQUAL; Expected value: TargetFunctionV1; Current value: 101a...909b.

I'm not overly familiar with EventBridge and cannot find anywhere in the console where the Target ID is shown or where, when attempting to manually add a Target, the ID value is declared. CloudFormation documentation states that the Id value has to be declared, so would have expected an option in the console where this value is declared and/or shown.

When running aws events list-targets-by-rule --rule <rule_name> this does confirm the Id value does not match the CloudFormation template. Given that the same template in another account has created the same rule with the correct ID, I don't understand how this value is different/changed.

Other than deleting the rule and then creating again, is there anyway of changing the ID value of an EventBridge Rule Target?

2 Answers
0

Hi,

You cannot change the ID in the console.

ID is added only for Cloudformation tracking purpose. You can update your template with ID as per below documentation https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html#cfn-events-rule-target-id

The ID might change of you update the rule manually which reflects as Drift in cloud formation.

answered a month ago
  • Thanks for the feedback, Ganesh. Most likely a manual change of some kind, as devs are prone to making undocumented changes. I found updating the value in the CloudFormation template didn't result in an update being applied. Had to resort to deleting the resource and recreating to get the resource/stack back IN_SYNC.

0

Hello,

You're right, the EventBridge console doesn't directly display or allow modification of the Target ID for a rule. Here's how to troubleshoot the issue and some alternative solutions:

Check these steps to trouble shoot the issue

verify Permissions: Ensure the IAM role used by CloudFormation has permissions to create Lambda functions and attach them as EventBridge rule targets. Check CloudTrail logs for any permission errors related to Lambda function creation or EventBridge rule target attachment.

CloudFormation Stack Differences: Compare the CloudFormation template causing the drift with the one working correctly. Look for any minor differences in the Target section, even typos or extra spaces.

CloudWatch Logs: Review CloudWatch logs for the Lambda function itself. Events might indicate issues during its creation or configuration. Check CloudWatch logs for EventBridge rule execution. Look for errors related to target invocation failures.

profile picture
EXPERT
Sandeep
answered a month ago