Skip to content

Instantly share code, notes, and snippets.

@lombax85
Created May 11, 2021 13:56
Show Gist options
  • Save lombax85/565d4199317627aacb64eb140d597c3a to your computer and use it in GitHub Desktop.
Save lombax85/565d4199317627aacb64eb140d597c3a to your computer and use it in GitHub Desktop.
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters" : {
"RecoveryInstance" : {
"Description" : "The EC2 instance ID to associate this alarm with.",
"Type" : "AWS::EC2::Instance::Id"
},
"SNSTopic" : {
"Description" : "The SNS Topic ARN to send the alarm to",
"Type" : "String"
}
},
"Resources": {
"RecoveryTestAlarm": {
"Type": "AWS::CloudWatch::Alarm",
"Properties": {
"AlarmDescription": "Trigger a recovery when instance status check fails for 15 consecutive minutes.",
"Namespace": "AWS/EC2" ,
"MetricName": "StatusCheckFailed_System",
"Statistic": "Minimum",
"Period": "60",
"EvaluationPeriods": "15",
"ComparisonOperator": "GreaterThanThreshold",
"Threshold": "0",
"AlarmActions": [ {"Fn::Join" : ["", ["arn:aws:automate:", { "Ref" : "AWS::Region" }, ":ec2:recover" ]]}, {"Ref" : "SNSTopic" } ],
"Dimensions": [{"Name": "InstanceId","Value": {"Ref": "RecoveryInstance"}}]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment