Ec2InstanceAction
Enum Stable
Types of EC2 actions available.
| Source | aws-cloudwatch-actions/lib/ec2.ts |
|---|
Example
ts
// 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),
);
python
# Alarm must be configured with an EC2 per-instance metric
# alarm: cloudwatch.Alarm
# Attach a reboot when alarm triggers
alarm.add_alarm_action(
actions.Ec2Action(actions.Ec2InstanceAction.REBOOT))
java
// Alarm must be configured with an EC2 per-instance metric
Alarm alarm;
// Attach a reboot when alarm triggers
alarm.addAlarmAction(
new Ec2Action(Ec2InstanceAction.REBOOT));
csharp
// Install: dotnet add package Amazon.CDK.Lib
// Alarm must be configured with an EC2 per-instance metric
Alarm alarm;
// Attach a reboot when alarm triggers
alarm.AddAlarmAction(
new Ec2Action(Ec2InstanceAction.REBOOT));
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// Alarm must be configured with an EC2 per-instance metric
var alarm Alarm
// Attach a reboot when alarm triggers
alarm.AddAlarmAction(
actions.NewEc2Action(actions.Ec2InstanceAction_REBOOT))
Members
| Member | Description |
|---|---|
STOP | Stop the instance. |
TERMINATE | Terminatethe instance. |
RECOVER | Recover the instance. |
REBOOT | Reboot the instance. |