Giter VIP home page Giter VIP logo

aws-lambda-cloudwatch-slack's Introduction

lambda-cloudwatch-slack

Amazon Lambda to receive alerts from CloudWatch and post to Slack.

What is This?

It's an Amazon lambda script that receives data from Amazon CloudWatch via, then posts that result over to Slack. Just configure the javascript file and set it in Lambda, then you are good to go.

How to Use

Alarm configuration

In handler.js, you will find ALARM_CONFIG, which is the config for your alarms. You can set different configs for different alarm conditions, depending on the subject of the CloudWatch notification.

name description
condition The script will match the CloudWatch's subject for this value
channel Which channel to post to
mention any mentions you will want to direct it at
color color of the sidebar when posted in slack
severity Optional text indicating the severity, just displayed in the message

Slack configuration

In handler.js, you will find SLACK_CONFIG, which is the config for you Slack. Set the correct values in this.

name description
token The token for your webhook URL.
team The name of your team.

If you have trouble finding the above, Go here to set up your Incoming Webbhook integration for Slack, https://api.slack.com/incoming-webhooks Then find your Webhook URL. The configs will be:

https://{team}.slack.com/services/hooks/incoming-webhook?token={token}

Amazon CloudWatch configuration

Set whatever CloudWatch you want in your CloudWatch settings. Be sure to remember the SNS topic you send the alarms to.

Amazon Lambda configuration

  1. In the Lambda console panel, create a new Lambda function. Set the name to be whatever you want it to be.
  2. For the code of the Lambda function, copy and paste the handler.js file.
  3. After you have created the function, select add event sources for the Lambda function.
  4. In the event sources, select SNS and select the topic for which you've created on CloudWatch.

That is all. You should be receiving CloudWatch alerts on your Slack.

Testing, Debugging

When you want to debug/test your Lambda function, try using my lambda-local NPM. It's a command-line tool that let's you execute Lambda functions on your local machine. https://github.com/ashiina/lambda-local

License

This library is released under the MIT license.

aws-lambda-cloudwatch-slack's People

Contributors

ashiina avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

isabella232

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.