=================
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?
- The CodeDeploy publishes deploy event to a SNS topic.
- Subscribers to that SNS topic - in this case Lyssna Lambda function - will execute.
- 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
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
- Create a
s3
folder inside./config
- Create configuration files based on examples in
./config
- In
./build
create aconfig.json
file based on the exampleconfig.sample.json
file. - Run
node build/archiver.js
- this will create alyssna-VERSION_NUMBER.zip
file.
- Based on your
./config/app.json
's s3 configuration, use the same in s3 location in./build/config.json
- Run
node build.upload.js
- this will use the aws cli to upload thelyssna-VERSION_NUMBER.zip
file and./config/s3
files to configured s3 location set in./build/config.json
Example for notification configs:
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.
SNS CloudWatch alarms - adding support to notify on CloudWatch alarms. GitHub Api - getting more information based on the commit SHA - for deployment details.
- Upload functionality to s3 based on configured location.
- 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.
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.