24 lines
592 B
HCL
24 lines
592 B
HCL
# terraform {
|
|
# required_providers {
|
|
# aws = {
|
|
# source = "hashicorp/aws"
|
|
# version = "~> 6.0"
|
|
# }
|
|
# }
|
|
# }
|
|
|
|
# provider "aws" {
|
|
# region = "us-east-1"
|
|
# }
|
|
|
|
resource "aws_cloudwatch_metric_alarm" "datacenter_alarm" {
|
|
alarm_name = "datacenter-alarm"
|
|
namespace = "AWS/EC2"
|
|
metric_name = "CPUUtilization"
|
|
statistic = "Average"
|
|
comparison_operator = "GreaterThanThreshold"
|
|
threshold = 80
|
|
period = 300
|
|
evaluation_periods = 1
|
|
alarm_description = "Alarm when EC2 CPU utilization exceeds 80%"
|
|
} |