Q37 — AWS DVA-C02 Ch.3
Question 37 of 100 | ← Chapter 3
A developer is building an event-driven application using AWS Lambda and Amazon EventBridge. The Lambda function needs to push events to the EventBridge event bus. The developer uses the SDK to invoke the PutEvents EventBridge operation but does not specify credentials in the code. After deploying the Lambda function, the developer notices that the function execution fails with an AccessDeniedException in the logs. How should the developer resolve this issue?
- A. Configure a VPC peering connection between the Lambda function and EventBridge.
- B. Modify their AWS credentials to include permissions for the PutEvents EventBridge operation.
- C. Modify the Lambda function’s execution role to include permissions for the PutEvents EventBridge operation. ✓
- D. Add a resource-based policy to the Lambda function to include permissions for the PutEvents EventBridge operation.
Correct Answer: C. Modify the Lambda function’s execution role to include permissions for the PutEvents EventBridge operation.
Explanation
Option C recommends modifying the Lambda function’s execution role to ensure it has the required permissions for the PutEvents EventBridge operation. The Lambda function execution role is the IAM role that the Lambda function assumes; modifying its permissions resolves the access-denied error.