class Ec2Action
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CloudWatch.Actions.Ec2Action |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscloudwatchactions#Ec2Action |
Java | software.amazon.awscdk.services.cloudwatch.actions.Ec2Action |
Python | aws_cdk.aws_cloudwatch_actions.Ec2Action |
TypeScript (source) | aws-cdk-lib » aws_cloudwatch_actions » Ec2Action |
Implements
IAlarm
Use an EC2 action as an Alarm 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),
);
Initializer
new Ec2Action(instanceAction: Ec2InstanceAction)
Parameters
- instanceAction
Ec2
Instance Action
Methods
Name | Description |
---|---|
bind(_scope, _alarm) | Returns an alarm action configuration to use an EC2 action as an alarm action. |
bind(_scope, _alarm)
public bind(_scope: Construct, _alarm: IAlarm): AlarmActionConfig
Parameters
Returns
Returns an alarm action configuration to use an EC2 action as an alarm action.