cdk-sns-notify
Project description
cdk-sns-notify
A CDK construct library to send line notify or discord webhook
Sample
import * as sns from "@aws-cdk/aws-sns";
import * as cloudwatch from "@aws-cdk/aws-cloudwatch";
import * as cw_actions from "@aws-cdk/aws-cloudwatch-actions";
import { SnsNotify } from "cdk-sns-notify";
const topic = new sns.Topic(stack, "Topic");
const metric = new cloudwatch.Metric({
namespace: "AWS/EC2",
metricName: "CPUUtilization",
dimensions: {
InstanceId: instance.instanceId,
},
period: cdk.Duration.minutes(1),
});
const alarm = new cloudwatch.Alarm(stack, "Alarm", {
metric,
threshold: 5,
evaluationPeriods: 1,
});
alarm.addAlarmAction(new cw_actions.SnsAction(topic));
const snsLineNotify = new SnsNotify(stack, "sns-line-notify", {
lineNotifyToken: "lineNotifyToken",
});
topic.addSubscription(snsLineNotify.lambdaSubscription);
Deploy
cdk deploy
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_sns_notify-0.0.940.tar.gz
(26.7 kB
view hashes)
Built Distribution
Close
Hashes for cdk_sns_notify-0.0.940-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b32d4a82d2b156e5ef7a4a97073f8b548de4e40468ebc4d43be7ee6b2c51632 |
|
MD5 | 4a65fdd337cc1a9e85266c580828a275 |
|
BLAKE2b-256 | 9dadc6f8d06e4df20a705e549ba36a3a61b87e7b4b3b144c356bbd480161bb2c |