Question 1 · choose 1
An engineer used the AWS CLI to create an Amazon EventBridge rule on the default event bus and to add an AWS Lambda function as its target. The rule's MatchedEvents metric rises as expected, but the function's logs and metrics show that it is never invoked. What is the most likely fix?
- ARaise the function's timeout to the maximum of 15 minutes so that the invocations can complete
- BAdd a statement to the function's resource-based policy that allows EventBridge to invoke it
- CAdd the events:PutEvents permission to the function's execution role
- DCreate an archive on the event bus and replay the events from it
Show the answer and why
ARaise the function's timeout to the maximum of 15 minutes so that the invocations can complete
Incorrect
The timeout limits how long a running invocation may take. A function that is never invoked is not timing out.
BAdd a statement to the function's resource-based policy that allows EventBridge to invoke it
Correct
Without permission, EventBridge cannot invoke the target. The troubleshooting guide's first check for this symptom is the function's policy (aws lambda get-policy).
CAdd the events:PutEvents permission to the function's execution role
Incorrect
The execution role grants the function permission to call other services. It does not let EventBridge call the function.
DCreate an archive on the event bus and replay the events from it
Incorrect
A replay sends the archived events to the bus again, and the rule would fail to invoke the function for the same reason.
The EventBridge console sets the target's permissions for you; from the CLI the engineer adds them, for example with aws lambda add-permission for the events.amazonaws.com principal. A rule that matches but never reaches its function points first at that permission.
AWS documentation
- Troubleshooting Amazon EventBridge (opens in a new tab)
- Using resource-based policies for Amazon EventBridge (opens in a new tab)
- Configure Lambda function timeout (opens in a new tab)
- Defining Lambda function permissions with an execution role (opens in a new tab)
- Archiving and replaying events in Amazon EventBridge (opens in a new tab)