Skip to content

Instantly share code, notes, and snippets.

@100daysofdevops
Last active March 1, 2019 17:37
Show Gist options
  • Select an option

  • Save 100daysofdevops/886998687b910e54eeac65915cdf2d77 to your computer and use it in GitHub Desktop.

Select an option

Save 100daysofdevops/886998687b910e54eeac65915cdf2d77 to your computer and use it in GitHub Desktop.
resource "aws_cloudwatch_metric_alarm" "instance-health-check" {
alarm_name = "instance-health-check"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "1"
metric_name = "StatusCheckFailed"
namespace = "AWS/EC2"
period = "120"
statistic = "Average"
threshold = "1"
alarm_description = "This metric monitors ec2 health status"
alarm_actions = [ "${aws_sns_topic.alarm.arn}" ]
dimensions {
InstanceId = "${aws_instance.my_instance.*.id[count.index}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment