I need to fetch information from a lambda function and remove an existing trigger (EventBridge) from this lambda using CLI (script needs to do that).
Tried to use list-event-source-mappings
or delete-event-source-mappings
but without success.
Seems like EventBridge isn’t supported yet (showing me only SQS,Kinesis,DynamoDB,MQ,MSK) but maybe I am wrong and there is a solution?
Edit:
I have a working lambda function that has associated trigger with an Eventbridge rule which was already deleted in the past. It no longer exists in my account, but, I still see it under my Lambda trigger (it also says that this rule cannot be found any more because it is deleted – again, it still appears in my Lambda trigger and I want to CLEAN it using CLI.) I wish to DELETE the association (trigger) from my Lambda, not to delete the EventBridge TARGET which is the Lambda.
2
Answers
You should be able to use
events
command:This will list the names of the rules that are associated with the specified target_arn. You can then use the
aws events describe-rule
command to get more information about each rule, including the rule id, schedule and pattern.Now to remove a trigger for a Lambda function in EventBridge:
The target_id is the unique identifier for the trigger that you want to remove, and the rule_name is the name of the rule that the trigger is associated with.
The APIs you are looking for are in the EventBridge events client:
Note: The terminology is a bit confusing. An Event Source Mapping is the technical term for the particular polling-type Lambda integration pattern that handles the sources you mention. It is not related to EventBridge events.