@aws-cdk/aws-cloudwatch-actions

Alarm Actions for AWS CloudWatch CDK library

Usage no npm install needed!

<script type="module">
  import awsCdkAwsCloudwatchActions from 'https://cdn.skypack.dev/@aws-cdk/aws-cloudwatch-actions';
</script>

README

CloudWatch Alarm Actions library


cdk-constructs: Stable


This library contains a set of classes which can be used as CloudWatch Alarm actions.

The currently implemented actions are: EC2 Actions, SNS Actions, SSM OpsCenter Actions, Autoscaling Actions and Application Autoscaling Actions

EC2 Action Example

// Alarm must be configured with an EC2 per-instance metric
declare const alarm: cloudwatch.Alarm;
// Attach a reboot when alarm triggers
alarm.addAlarmAction(
  new actions.Ec2Action(actions.Ec2InstanceAction.REBOOT),
);

SSM OpsCenter Action Example

declare const alarm: cloudwatch.Alarm;
// Create an OpsItem with specific severity and category when alarm triggers
alarm.addAlarmAction(
  new actions.SsmAction(
    actions.OpsItemSeverity.CRITICAL,
    actions.OpsItemCategory.PERFORMANCE // category is optional
  )
);

See @aws-cdk/aws-cloudwatch for more information.