Skip to content

An AWS serverless function (lambda) written in Go, that takes Cloudwatch Alarms from SNS and publish them to Google Chat (using a Google Chat webhook)

License

Notifications You must be signed in to change notification settings

JamesJJ/cloudwatch-to-google-chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub go.mod Go version GitHub GitHub release (latest SemVer) GitHub Workflow Status

Cloudwatch Alarms in Google Chat

This is an AWS Lambda function written in Go that receives alarms from AWS Cloudwatch and publishes them to a Google Chat chat room.

Service-In-AWS --> Cloudwatch Alarms --> SNS --> This-Lambda --> Google Chat

Deployment using AWS SAM

Deployment uses the AWS Serverless Application Model, with the template and config provided.

Prerequisites

You'll need:

  • go installed (version 1.16 or newer)
  • AWS SAM CLI installed
  • AWS CLI credentials set-up

Deploying to AWS

The deploy.sh script was tested on MacOS, and should work on Linux. You may need to adjust it if you are using Windows.

  1. Create an SNS Topic and configure your Cloudwatch Alarms to send notifications to it (if you have not already done so).
  2. Create a webhook in Google Chat.
  3. Execute ./aws-serverless/deploy.sh -g
  4. Enter parameter values when prompted:
  • ChatWebhookUrl The Google Chat webhook URL.
  • AlertImageUrl The URL of an image to show at the top of ALARM notification messages (optional; e.g. the exclamation triangle in the screenshot below).
  • OkImageUrl The URL of an image to show at the top of OK notification messages (optional; e.g. the tick-mark in the screenshot below)
  • SnsArn The ARN of the existing SNS Topic.
  • Use the default values for the other parameters.

Screenshot