cdk-watchful-edge
Watching your CDK back since 2019
Watchful is an AWS CDK construct library that makes it easy to monitor CDK apps.
TypeScript:
import { Watchful } from 'cdk-watchful'
const wf = new Watchful(this, 'watchful');
wf.watchDynamoTable('My Cute Little Table', myTable);
wf.watchLambdaFunction('My Function', myFunction);
wf.watchApiGateway('My REST API', myRestApi);
Python:
from cdk_watchful import Watchful
wf = Watchful(self, 'watchful')
wf.watch_dynamo_table('My Cute Little Table', my_table)
wf.watch_lambda_function('My Function', my_function)
wf.watch_api_gateway('My REST API', my_rest_api)
And...
Install
TypeScript/JavaScript:
$ npm install cdk-watchful-edge
Python:
$ pip install cdk-watchful-edge
Initialize
To get started, just define a Watchful
construct in your CDK app (code is in
TypeScript, but python will work too). You can initialize using an email address, SQS arn or both:
TypeScript:
import { Watchful } from 'cdk-watchful'
import sns = require('@aws-cdk/aws-sns');
import sqs = require('@aws-cdk/aws-sqs');
const alarmSqs = sqs.Queue.fromQueueArn(this, 'AlarmQueue', 'arn:aws:sqs:us-east-1:444455556666:alarm-queue')
const alarmSns = sns.Topic.fromTopicArn(this, 'AlarmTopic', 'arn:aws:sns:us-east-2:444455556666:MyTopic');
const wf = new Watchful(this, 'watchful', {
alarmEmail: 'your@email.com',
alarmSqs,
alarmSns,
});
Python:
from cdk_watchful import Watchful
alarm_sqs = sqs.Queue.from_queue_arn(self, 'AlarmQueue', 'arn:aws:sqs:us-east-1:444455556666:alarm-queue')
alarm_sns = sns.Topic.from_topic_arn(self, 'AlarmTopic', 'arn:aws:sns:us-east-2:444455556666:MyTopic')
wf = Watchful(
self,
'watchful',
alarm_email='your@amil.com',
alarm_sqs=alarm_sqs,
alarm_sns=alarm_sns
Add Resources
Watchful manages a central dashboard and configures default alarming for:
- Amazon DynamoDB:
watchful.watchDynamoTable
- AWS Lambda:
watchful.watchLambdaFunction
- Amazon API Gateway:
watchful.watchApiGateway
- Request yours
Watching Scopes
Watchful can also watch complete CDK construct scopes. It will automatically discover all watchable resources within that scope (recursively), add them to your dashboard and configure alarms for them.
TypeScript:
wf.watchScope(storageLayer);
Python:
wf.watch_scope(storage_layer)
Example
See a more complete example.