Amazon EventBridge to Amazon CloudWatch Logs

EventBridge → CloudWatch Logs

Create an EventBridge rule that sends events to CloudWatch Logs

This template creates an EventBridge event bus and rule that publishes matched events to CloudWatch Logs. In this example, the rule filters for specific attributes in the event before sending to the CloudWatch Logs target.

< 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-cloudwatch

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. The event appears in the CloudWatch Logs stream called /aws/events/resource-policy-test.

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:

James Beswick

James Beswick

I am a self-confessed serverless geek and enjoy helping developers build faster with serverless! I have been software developer and product manager before becoming a Developer Advocate. Ask me anything!

Follow on LinkedIn