Code Monkey home page Code Monkey logo

aws-maintenance-lambda's Introduction

A lambda function to send alerts (to Slack, Hipchat) on AWS maintenance events. While the email from AWS includes only the instance id, the alert will include the Name of the instance and owner from the appropriate tags.

Sample Notification on Slack

Sample notification on HipChat

Prerequisite

The lambda function assumes that all resources (EC2 instances) are tagged with a key Owner specifying the owner of the resource.

Installation

Update lambda/config.json with necessary config for your environment. The keys are explained below:

store.simpledb.domain - The lambda function keeps track of processed events in AWS simbedb. This configures the simpledb domain to be used for this purpose.

notification.hipchat

  • auth_token - The Hipchat API token.
  • room - The room to send the notifications to.
  • icon_url - Icon to use for the bot that sends the notification.
  • username - Username of the bot that sends the notification.
  • owners - List of owners per tag. The keys here will be the value of the tag Owner. This maps the tag value to owners - for example - "devops : { "owner": "@devops_team"}"
    • all - this is a catchall owner that is used as default if the resource did not have the Owner tag.

notification.slack

  • hook - The slack hook url.
  • channel - The channel to send the notifications to.
  • icon_url - Icon to use for the bot that sends the notification.
  • username - Username of the bot that sends the notification.
  • owners - List of owners per tag. The keys here will be the value of the tag Owner. This maps the tag value to owners - for example - "devops : { "owner": "@devops_team"}"
    • all - this is a catchall owner that is used as default if the resource did not have the Owner tag.

Manual

Once the config.json has been updated, the lambda function can be manually installed by doing a npm install --production, zipping up the entire lambda folder and uploading to AWS like any other lambda function.

Terraform

The terraform plans to setup the lambda function are available at https://github.com/indix/terraform-aws-maintenance-lambda

It is also available as a module in the Terraform registry - https://registry.terraform.io/modules/indix/maintenance-lambda/aws

The plans include the necessary IAM roles and lambda schedule (once an hour by default). A normal terraform plan and terraform apply should fully setup the lambda function. Requires terraform 0.8.0+.

Example usage as a module:

module "aws-maintenance-lambda" {
  source =  "indix/maintenance-lambda/aws"

  lambda_prepared_source_dir = "${path.root}/aws-maintenance-lambda-temp/source"
  lambda_archive_path = "${path.root}/aws-maintenance-lambda-temp/dist/aws_maintenance_lambda.zip"
  config_json = "${path.root}/files/aws-maintenance-lambda-config.json"
}

License

This is an open source project licensed under the Apache License, Version 2.0.

aws-maintenance-lambda's People

Contributors

manojlds avatar

Watchers

James Cloos avatar MOHIDEEN IBN MOHAMMED avatar

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.