aws-cdk-lib.aws_cloudwatch_actions-readme

aws-cdk-lib.aws_cloudwatch_actions module

LanguagePackage
.NETAmazon.CDK.AWS.CloudWatch.Actions
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscloudwatchactions
Javasoftware.amazon.awscdk.services.cloudwatch.actions
Pythonaws_cdk.aws_cloudwatch_actions
TypeScriptaws-cdk-lib » aws_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
declare const alarm: cloudwatch.Alarm;
// Attach a reboot when alarm triggers
alarm.addAlarmAction(
  new actions.Ec2Action(actions.Ec2InstanceAction.REBOOT),
);

Example not in your language?

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
  )
);

Example not in your language?

SSM Incident Manager Action Example

declare const alarm: cloudwatch.Alarm;
// Create an Incident Manager incident based on a specific response plan
alarm.addAlarmAction(
  new actions.SsmIncidentAction('ResponsePlanName')
);

Example not in your language?

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