Amazon EventBridge to AWS Lambda

EventBridge → AWS Lambda

Create an EventBridge rule that invokes a Lambda function

This template deploys a Lambda function that is triggered by an EventBridge rule. In this example, the rule filters for specific attributes in the event before invoking the function.
The Events section of the AWS::Serverless::Function type also sets up the required permissions for EventBridge to invoke this specific function.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/eventbridge-lambda-rust

Deploy

sam deploy --guided


Testing

Use the AWS CLI to send a test event to EventBridge and observe the event delivered to the Lambda function:
1. Send an event to EventBridge: aws events put-events --entries file://event.json.
2. Retrieve the logs from the Lambda function: sam logs -n ENTER_YOUR_CONSUMER_FUNCTION_NAME.

Cleanup

1. Delete the stack: sam delete --stack-name STACK_NAME.
2. Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus"

Created by:

Daniele Frasca

Daniele Frasca

I am Daniele Frasca serverless enthusiast. I build and architect serverless applications at scale.