Package software.amazon.awscdk.services.cloudwatch.actions
package software.amazon.awscdk.services.cloudwatch.actions
CloudWatch Alarm Actions library
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 Alarm alarm; // Attach a reboot when alarm triggers alarm.addAlarmAction( new Ec2Action(Ec2InstanceAction.REBOOT));
SSM OpsCenter Action Example
Alarm alarm; // Create an OpsItem with specific severity and category when alarm triggers alarm.addAlarmAction( new SsmAction(OpsItemSeverity.CRITICAL, OpsItemCategory.PERFORMANCE));
SSM Incident Manager Action Example
Alarm alarm; // Create an Incident Manager incident based on a specific response plan alarm.addAlarmAction( new SsmIncidentAction("ResponsePlanName"));
Lambda Action Example
import software.amazon.awscdk.services.lambda.*; Alarm alarm; Function fn; Alias alias; Version version; // Attach a Lambda Function when alarm triggers alarm.addAlarmAction( new LambdaAction(fn)); // Attach a Lambda Function Alias when alarm triggers alarm.addAlarmAction( new LambdaAction(alias)); // Attach a Lambda Function version when alarm triggers alarm.addAlarmAction( new LambdaAction(version));
See aws-cdk-lib/aws-cloudwatch
for more information.
-
ClassDescriptionUse an ApplicationAutoScaling StepScalingAction as an Alarm Action.Use an AutoScaling StepScalingAction as an Alarm Action.Use an EC2 action as an Alarm action.Types of EC2 actions available.Use a Lambda action as an Alarm action.Types of OpsItem category available.Types of OpsItem severity available.Use an SNS topic as an alarm action.Use an SSM OpsItem action as an Alarm action.Use an SSM Incident Response Plan as an Alarm action.