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';
import { Construct } from 'constructs';
export class CdkDemoStack extends cdk.Stack {
constructor(scope: Construct, 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 slackAlarmIntegration = new CdkSlackChatBot(this, 'SlackIntegration', {
topicName: 'slack-alarm',
slackChannelId: 'xxx',
slackWorkSpaceId: 'yyy',
slackChannelConfigName: 'slack',
});
alarm.addAlarmAction(new cloudwatch_actions.SnsAction(slackAlarmIntegration.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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cdk-slack-chatbot-1.0.35.tar.gz.
File metadata
- Download URL: cdk-slack-chatbot-1.0.35.tar.gz
- Upload date:
- Size: 27.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48a716239764f0af367bd07a90d0e1b93b00218979914af8f87491b8de7f23f4
|
|
| MD5 |
48d99acceea577ab6fa4e9c63a2d3a18
|
|
| BLAKE2b-256 |
d540642c42bc8c8dac59cfa6abc4b8b73c8a9b6319b50fedbfc3f2f621088181
|
File details
Details for the file cdk_slack_chatbot-1.0.35-py3-none-any.whl.
File metadata
- Download URL: cdk_slack_chatbot-1.0.35-py3-none-any.whl
- Upload date:
- Size: 25.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a61554d526f79fb7a8407cc023c302eee70d343fda7ff531e8b68778570129f9
|
|
| MD5 |
7ae425e514324166842c4da4f92de116
|
|
| BLAKE2b-256 |
654fe032a57c841388df1b137936d97d84511006e0812c03be985052648fc29d
|