Giter Site home page Giter Site logo

danieldacosta / cloudwatch-alarms Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 5.0 926 KB

CloudWatch-SNS-Lambda integration that sends alarm notification to discord channel

License: Apache License 2.0

HCL 0.33% Python 99.67%
lambda-alarm cloudwatch-alarms sns-topic lambda-zip discord-channel

cloudwatch-alarms's Introduction

Cloudwatch Alarms with SNS topic

This repository contains the following topics:

  • Cloudwatch alarms resources to be created based on the lambda name.
  • SNS topic that will be triggered by the alarm
  • Lambda-alarm that will send the message received from SNS to a Discord channel through a WEBHOOK_URL

Files

  • lambda/*: Contains the lambda-alarm zip code that is stored in s3
  • sns.tf: creates SNS topic
  • iam.tf: Lambda permission
  • lambda-alarm: Containes lambda-alarm tf file
  • cloudwatch.tf: creates alarms

Usage

terraform apply -var-file="variables.tfvars"

CloudWatch alarms

In this example, the service that is being monitored is: AWS Lambda, but you can easily use it to monitor others services (SQS, ECS, EC2, ...).

If you'd like to add a new lambda to me monitored you just have to add it in the following local variable:

locals {
  name_dash = "${var.name}-${var.environment}"
  # Lambda with Alarms
  alarms_dimensions = {
    "${var.name}-${var.environment}-lambda-1" = {
      FunctionName = "${var.name}-${var.environment}-lambda-1"
    },
    "lambda-2" = {
      FunctionName = "lambda-y"
    },
    "lambda-3" = {
      FunctionName = "lambda-z"
    },
    "new-lambda" = {
      FunctionName = "NEW-LAMBDA"
    }
  }
}

SNS topic

You will just have to create a SNS topic and link it with your lambda-alarm.

Lambda-Alarm

This lambda zip is stored in a s3 bucket. You can find lambda's code inside the folder lambda

Medium Post

More details on my Medium Post: Discord notification using CloudWatch Alarms, SNS and AWS Lambda

References

cloudwatch-alarms's People

Contributors

danieldacosta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cloudwatch-alarms's Issues

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.