Git Product home page Git Product logo

cloudwatch-sns-slack-notifier's Introduction

Slack Notifier for Cloudwatch Alarms

This is a simple lambda which is designed to be a consumer of an SNS topic which is fired off the back of a cloudwatch alarm.

I designed this to be when a load balancer reports a 5XX response but it can be tweaked for other use-cases.

Usage

  1. Update the lambda code with your Slack endpoint URL
  2. Deploy the lambda using serverless deploy.
  3. Wire up the SNS topic subcriptions to include your lambda.

Done!

You can test-fire the lambda using the test event to make sure it's working and posting to your Slack workspace using the example event below.

Example

A SNS alert comes in to the lambda in the event argument in the form of:

{
  "Records": [
    {
      "EventSource": "aws:sns",
      "EventVersion": "1.0",
      "EventSubscriptionArn": "arn:aws:sns:<REGION>:<ACCOUNT_NUMBER>:<TOPIC>:<TOPIC_ID>",
      "Sns": {
        "Type": "Notification",
        "MessageId": "<MESSAGE_ID>",
        "TopicArn": "arn:aws:sns:<REGION>:<ACCOUNT_NUMBER>:<TOPIC>",
        "Subject": "ALARM: <YOUR_ALARM>",
        "Message": "{
          \"AlarmName\":\"<ALARM_NAME>\",
          \"AlarmDescription\":\"<CLOUDWATCH_ALARM_DESCRIPTION>\",
          \"AWSAccountId\":\"<ACCOUNT_NUMBER>\",
          ...etc
        }",
        "Timestamp": "2019-10-04T02:02:37.830Z",
      }
    }
  ]
}

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.