serverless-alarm-notification-plugin

This Serverless plugin deploys CloudFormation Stack with resources required to send customized notification message to specified webhook endpoint for configured CloudWatch alarms.

Usage no npm install needed!

<script type="module">
  import serverlessAlarmNotificationPlugin from 'https://cdn.skypack.dev/serverless-alarm-notification-plugin';
</script>

README

📋 Serverless Alarm Notification Plugin

This Serverless plugin deploys CloudFormation Stack with resources required to send customized notification message to specified webhook endpoint for configured CloudWatch alarms.

Installation

$ yarn add -D serverless-alarm-notification-plugin

Usage

Add the following configuration to your serverless.yml.

plugins:
  - serverless-alarm-notification-plugin

custom:
  alarmNotification:
    name: alarm-notification
    webhookUrl: [YOUR_WEBHOOK_ENDPOINT]
    stages:
      - staging
      - production

Run yarn sls deploy to deploy your serverless stack with this stack.

Properties

  1. name: Optional (Default to alarm-notification. This will be used as part of your CloudFormation stack name.)
  2. webhookUrl: Required (Webhook endpoint url to send notification to)

Note: Camelcase version of property name is used to prefix all stack resource logical ids and output variables.

Example Serverless Configuration

service: awesome-service
frameworkVersion: ">2"
provider:
  name: aws
  stage: dev
  runtime: nodejs14.x
  region: us-east-1

plugins:
  - serverless-alarm-notification-plugin

custom:
  alarmNotification:
    name: alarm-notification
    webhookUrl: [webhook-endpoint-url]

As part of running sls deploy, a CloudFormation stack awesome-service-alarm-notification will be created, which includes a Lambda function awesome-service-send-notification-dev, which can be used to attach to a SNS topic to send alarm notifications.