Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
fix: solve issues with CW Alarm URLs, add development stack, update t…
Browse files Browse the repository at this point in the history
…o node 20 (#312)
  • Loading branch information
janguntowski authored Jan 9, 2024
1 parent 478de17 commit 03311b6
Show file tree
Hide file tree
Showing 15 changed files with 2,294 additions and 5,708 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '20'
cache: npm

- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/node-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '20'
cache: npm

- name: Install dependencies
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ dist
.aws-sam
samconfig.toml
sonar-report.xml
.idea
.idea
.cdk.staging
cdk.out
cdk.context.json
36 changes: 36 additions & 0 deletions dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Development and debugging setup for cloudwatch-alarm-to-ms-teams

This folder contains a small CDK stack that deploys the application's lambda function directly from source and connects a test alarm to it.
Useful for debugging or when working on the layout of the adaptive cards.

> [!CAUTION]
>
> USE AT YOUR OWN RISK!
> Using this stack will incur cost. Created and used AWS resources are a lambda function, an associated IAM role
> a sns topic, a cloudwatch alarm and a CloudWatch LogGroup
> HTTPS calls to the provided webhook URL will be made!
>
> The setup uses minimal configuration. Never deploy to an AWS account with production workloads!
# Prerequisites

- Access to an AWS account with required permissions
- The account needs to be [bootstrapped for CDK](https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html).
- if it isn't, run `npx cdk bootstrap aws://ACCOUNT-NUMBER/REGION` with proper permissions to achieve that
- node.js >=20 installed
- A Webhook URL for Microsoft Teams

# Usage

- Run `npm install` in this folder
- Deploy providing your webhook url by running `npm run cdk-deploy -- -c webhook-url=https://your-webhook-url`
- Later clean up by running `npm run cdk-destroy` (or delete the stack `CloudWatchAlarmToMsTeamsDevelopment` in CloudFormation)

# What it does

- The cloudwatch-alarm-to-ms-teams [lambda function](../src/handlers) will be packaged and deployed directly from source
- it will be parameterized with the provided webhook URL
- A flickering CloudWatch alarm (switching between alarm and OK state every ~ 5 minutes, can be sped up by modifying the alarm config) will be created that triggers the lambda via SNS
- If everything works, you'll get an adaptive card send to your Webhook URL almost immediately after deployment.
- perform code changes and redeploy as required, you'll keep getting fast feedback directly to your Webhook URL

Loading

0 comments on commit 03311b6

Please sign in to comment.