Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lvthillo/cdk-slack-chatbot
A CDK construct which creates an SNS AWS ChatBot (Slack) integration for CloudWatch alarms.
https://github.com/lvthillo/cdk-slack-chatbot
aws aws-chatbot cdk
Last synced: 2 months ago
JSON representation
A CDK construct which creates an SNS AWS ChatBot (Slack) integration for CloudWatch alarms.
- Host: GitHub
- URL: https://github.com/lvthillo/cdk-slack-chatbot
- Owner: lvthillo
- License: apache-2.0
- Created: 2022-08-24T16:56:32.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-28T05:15:59.000Z (about 1 year ago)
- Last Synced: 2024-11-13T13:04:40.333Z (2 months ago)
- Topics: aws, aws-chatbot, cdk
- Language: TypeScript
- Homepage:
- Size: 1.45 MB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![NPM version](https://badge.fury.io/js/cdk-slack-chatbot.svg)](https://badge.fury.io/js/cdk-slack-chatbot)
[![PyPI version](https://badge.fury.io/py/cdk-slack-chatbot.svg)](https://badge.fury.io/py/cdk-slack-chatbot)
![Release](https://github.com/lvthillo/cdk-slack-chatbot/workflows/release/badge.svg)# cdk-slack-chatbot
A CDK construct which creates an SNS AWS ChatBot (Slack) integration for CloudWatch alarms, AWS Config rules, ...\
More information on how to use this construct can be found [here](https://github.com/lvthillo/cdk-slack-chatbot/blob/main/API.md).# Architecture
## Example
In this example we create a CloudWatch alarm which integrates with our construct.
```ts
import * as cdk from 'aws-cdk-lib';
import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
import * as cloudwatch_actions from 'aws-cdk-lib/aws-cloudwatch-actions';
import * as sqs from 'aws-cdk-lib/aws-sqs';
import { CdkSlackChatBot } from 'cdk-slack-chatbot';export class CdkDemoStack extends cdk.Stack {
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props);const queue = new sqs.Queue(this, 'HelloCdkQueue', {
visibilityTimeout: cdk.Duration.seconds(300)
});const qMetric = queue.metric('ApproximateNumberOfMessagesVisible');
const alarm = new cloudwatch.Alarm(this, 'Alarm', {
metric: qMetric,
threshold: 100,
evaluationPeriods: 3,
datapointsToAlarm: 2
});const slackIntegration = new CdkSlackChatBot(this, 'SlackIntegration', {
topicName: 'slack-alarm',
slackChannelId: 'xxx',
slackWorkSpaceId: 'yyy',
slackChannelConfigName: 'slack',
});alarm.addAlarmAction(new cloudwatch_actions.SnsAction(slackIntegration.topic));
}
}
```Test Alarm:
```
$ aws cloudwatch set-alarm-state --alarm-name "xxx" --state-value ALARM --state-reason "testing purposes"
```