@aws-cdk/aws-cloudwatch-actions module
Language | Package |
---|---|
.NET | Amazon.CDK.AWS.CloudWatch.Actions |
Java | software.amazon.awscdk.services.cloudwatch.actions |
Python | aws_cdk.aws_cloudwatch_actions |
TypeScript | @aws-cdk/aws-cloudwatch-actions |
CloudWatch Alarm Actions library
AWS CDK v1 has reached End-of-Support on 2023-06-01. This package is no longer being updated, and users should migrate to AWS CDK v2.
For more information on how to migrate, see the Migrating to AWS CDK v2 guide.
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.