Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save 100daysofdevops/a87b78648ef30d83710136febd7fcfd7 to your computer and use it in GitHub Desktop.
resource "aws_cloudwatch_metric_alarm" "cpu-utilization" {
alarm_name = "high-cpu-utilization-alarm"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "2"
metric_name = "CPUUtilization"
namespace = "AWS/EC2"
period = "120"
statistic = "Average"
threshold = "80"
alarm_description = "This metric monitors ec2 cpu utilization"
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