Skip to content

Lyssna is a Lambda (node/javascript) library that subscribes to CodeDeploy SNS events. Lyssna takes these events and matches them with provided notification channels, and sends these events to those notifications channels.

License

karlnorling/lyssna

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to Lyssna

=================

Lyssna is a Lambda (node/javascript) library that subscribes to CodeDeploy SNS events.

Lyssna takes these events and matches them with provided notification channels, and sends these events to those notifications channels.

How does it work?

  1. The CodeDeploy publishes deploy event to a SNS topic.
  2. Subscribers to that SNS topic - in this case Lyssna Lambda function - will execute.
  3. During execution it looks at the SNS Event trigger name, SNS message application name and based on channel configurations sends a notification to these channels.

How does one create the SNS triggers, instructions can be found here

Configuration

To setup the triggers for notifications we need to configure which SNS events to trigger on.

These json files are stored in S3. Location is based on configuration from config/app.json

Example of app configuration

To create configuration files and bundle app for upload:

  1. Create a s3 folder inside ./config
  2. Create configuration files based on examples in ./config
  3. In ./build create a config.json file based on the example config.sample.json file.
  4. Run node build/archiver.js - this will create a lyssna-VERSION_NUMBER.zip file.

Upload lambda function zip file code and configuration to S3.

  1. Based on your ./config/app.json's s3 configuration, use the same in s3 location in ./build/config.json
  2. Run node build.upload.js - this will use the aws cli to upload the lyssna-VERSION_NUMBER.zip file and ./config/s3 files to configured s3 location set in ./build/config.json

Notification channel config example (to be stored in S3) encrypted bucket)


Example for notification configs:

Deployer information


How do I know whom started the deploy? Right now there's no user information in the CodeDeploy SNS event. We can work around this by adding meta tags to the file in S3 that's getting deployed. That way we can get some user information.

Add a meta tag on the S3 object with the key of: x-amz-meta-user. The value should be whatever the user is that you want to be associated with the deploy.

Supported notification channels:


Screenshots

Slack

Upcoming notification channels:


Upcoming integrations:


SNS CloudWatch alarms - adding support to notify on CloudWatch alarms. GitHub Api - getting more information based on the commit SHA - for deployment details.

Upcoming features:


  1. Upload functionality to s3 based on configured location.
  2. Create Lambda function based on the uploaded zip file, create SNS Topic and IAM roles with permission, add triggers to CodeDeploy applications - all via CloudFormation templates.

SNS CodeDeploy event examples


These are just examples - the best example is get a Code Deploy SNS Event from your own aws environment. This is because some data in the SNS Event is used as values for some aws cli api calls.

About

Lyssna is a Lambda (node/javascript) library that subscribes to CodeDeploy SNS events. Lyssna takes these events and matches them with provided notification channels, and sends these events to those notifications channels.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published