Home

Awesome

<p align="center"> <img src="docs/aws_maintenance_lambda.png"/> </p>

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

notification.slack

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.