Skip to content

Technique to publish to EventBridge by simply writing to the log

License

Notifications You must be signed in to change notification settings

perpil/logs-to-eb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This is a repo to illustrate the ability to publish events to EventBridge by writing to the lambda log. The details of the approach are covered here

Code

The CDK stack to create the two lambdas, an event bus and subscription filter:

CDK stack

The lambda that writes to the log:

Messenger lambda

The lambda that is triggered by the CloudWatch Subscription Filter and publishes the Event to Event Bridge:

Bridgify lambda

Deployment

This uses the CDK to deploy the infrastructure. You can install the CDK here

npm install
cdk deploy

Invoking

If you have Speedrun installed and enabled on this repository and have configured it with a role that allows you to invoke lambdas, you can invoke the messenger lambda with:

#!lambda
~~~functionUrl=Function URL{suppress: true}~~~
{
  "message": ~~~Message {transform: 'JSON.stringify(value)'}~~~
}

The function url will be printed in the output of the CDK deploy command.

Useful commands

  • npm install get all of the packages
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk synth emits the synthesized CloudFormation template

About

Technique to publish to EventBridge by simply writing to the log

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published