seahaven-ap/terraform/alarms.tf

34 lines
1 KiB
HCL

resource "aws_cloudwatch_metric_alarm" "alb_5xx" {
alarm_name = "${local.project}-alb-5xx"
comparison_operator = "GreaterThanThreshold"
evaluation_periods = 1
metric_name = "HTTPCode_Target_5XX_Count"
namespace = "AWS/ApplicationELB"
period = 60
statistic = "Sum"
threshold = 0
treat_missing_data = "notBreaching"
alarm_description = "ALB target 5xx for seahaven-ap."
dimensions = {
LoadBalancer = aws_lb.api.arn_suffix
}
}
resource "aws_cloudwatch_metric_alarm" "ecs_cpu" {
alarm_name = "${local.project}-ecs-cpu"
comparison_operator = "GreaterThanThreshold"
evaluation_periods = 2
metric_name = "CPUUtilization"
namespace = "AWS/ECS"
period = 300
statistic = "Average"
threshold = 80
treat_missing_data = "notBreaching"
alarm_description = "seahaven-ap ECS CPU above 80 percent."
dimensions = {
ClusterName = aws_ecs_cluster.api.name
ServiceName = aws_ecs_service.api.name
}
}