cdk-slack-chatbot
Project description
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.
Architecture
Example
In this example we create a CloudWatch alarm which integrates with our construct.
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"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cdk-slack-chatbot-1.0.198.tar.gz
(27.7 kB
view details)
Built Distribution
File details
Details for the file cdk-slack-chatbot-1.0.198.tar.gz
.
File metadata
- Download URL: cdk-slack-chatbot-1.0.198.tar.gz
- Upload date:
- Size: 27.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0307e62eb6fb0527977b67d670cd1fe364afb330e3385039f62689b21201c05e |
|
MD5 | 927518a45c366207bd103d3a287647ac |
|
BLAKE2b-256 | 7d471e0219f5cfc3f46ee30949bbbb29c66114d8a70fc574c739009053939cc1 |
File details
Details for the file cdk_slack_chatbot-1.0.198-py3-none-any.whl
.
File metadata
- Download URL: cdk_slack_chatbot-1.0.198-py3-none-any.whl
- Upload date:
- Size: 26.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4a7c95c0648db21c8b15bd41aa03bb29675d39dce172281c8deea983b2cc1e4 |
|
MD5 | a6c46eb3e90ed69decccb51c3527aaab |
|
BLAKE2b-256 | 16acca37ea59a6fade6fa60577d5479a52f8f1b58ba11b2186c8a223784311ce |