Creates a CloudWatch Metric Alarm for monitoring EC2 CPU utilization to trigger if it meets or exceeds a threshold.

Terraform Template

resource "aws_cloudwatch_metric_alarm" "foobar" {
  alarm_description = "This metric monitors ec2 cpu utilization"
  alarm_name = "terraform-test-foobar5"
  comparison_operator = "GreaterThanOrEqualToThreshold"
  evaluation_periods = 2
  metric_name = "CPUUtilization"
  namespace = "AWS/EC2"
  period = 120
  statistic = "Average"
  threshold = 80
}