@beigetech/cdk-alarms
v0.1.4
Published
[![npm version](https://badge.fury.io/js/%40beigetech%2Fcdk-alarms.svg)](https://badge.fury.io/js/%40beigetech%2Fcdk-alarms) [![Coverage Status](https://coveralls.io/repos/github/beigetech/cdk-alarms/badge.svg?branch=guy/deploy)](https://coveralls.io/gith
Downloads
4
Readme
@beigetech/cdk-alarms: Alarms for AWS Resources
Create CloudWatch alarms and event notifications for AWS resources, supported constructs:
Database Instance
Either create alarms for the instance all at once, individually or use the builder for full control.
let stack = new Stack();
let inst = new DatabaseInstance(stack, "test-cluster", {});
Generate alarms for instance:
Import {DatabaseAlarms} from '@beigetech/cdk-alarms';
DatabaseAlarm.createInstanceAlarms(stack, cluster);
Generate individual alarms:
DatabaserAlarm.createCpuAlarm(stack, cluster);
Or use a builder for custom alarms
DatabaseAlarm.createAlarm(stack, cluster)
.setMetric(CLUSTER_METRIC.CPU_UTILISATION)
.setThreshold(90)
.setOp(ComparisoOperator.GREATER_THAN_THRESHOLD)
.build()
Database Cluster
You can either create alarms for an instance of a cluster all at once, optionally overriding the threshold values or using the defaults.
let stack = new Stack();
let cluster = new DatabaseCluster(stack, "test-cluster", {
engine: DatabaseClusterEngine.AURORA_MYSQL,
masterUser: {
username: "admin",
},
instanceProps: {
vpc: new Vpc(stack, "test-vpc"),
instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.MICRO),
},
});
Generate alarms for instance:
Import {DatabaseAlarms} from '@beigetech/cdk-alarms';
DatabaseClusterAlarm.createClusterAlarms(stack, cluster);
Generate individual alarms:
DatabaseClusterAlarm.createCpuAlarm(stack, cluster);
Or use a builder for custom alarms
DatabaseClusterAlarm.createAlarm(stack, cluster)
.setMetric(CLUSTER_METRIC.CPU_UTILISATION)
.setThreshold(90)
.setOp(ComparisoOperator.GREATER_THAN_THRESHOLD)
.build()