From 9e53e164ce9a498b41695d80223aec82920cd877 Mon Sep 17 00:00:00 2001 From: Pat Heard Date: Tue, 10 Sep 2024 16:29:39 -0400 Subject: [PATCH] fix: use maximum CPU/memory stat for alarms (#820) Update the App, API and IdP ECS CPU and memory alarms to use the Maximum statistic rather than Average. This will make the alarms more responsive to individual ECS tasks that are overloaded. --- aws/alarms/cloudwatch_api.tf | 4 ++-- aws/alarms/cloudwatch_app.tf | 4 ++-- aws/alarms/cloudwatch_idp.tf | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/aws/alarms/cloudwatch_api.tf b/aws/alarms/cloudwatch_api.tf index 58ff30f51..93ab4ce87 100644 --- a/aws/alarms/cloudwatch_api.tf +++ b/aws/alarms/cloudwatch_api.tf @@ -11,7 +11,7 @@ resource "aws_cloudwatch_metric_alarm" "api_cpu_utilization_high_warn" { metric_name = "CPUUtilization" namespace = "AWS/ECS" period = "120" - statistic = "Average" + statistic = "Maximum" threshold = var.threshold_ecs_cpu_utilization_high treat_missing_data = "notBreaching" @@ -34,7 +34,7 @@ resource "aws_cloudwatch_metric_alarm" "api_memory_utilization_high_warn" { metric_name = "MemoryUtilization" namespace = "AWS/ECS" period = "120" - statistic = "Average" + statistic = "Maximum" threshold = var.threshold_ecs_memory_utilization_high treat_missing_data = "notBreaching" diff --git a/aws/alarms/cloudwatch_app.tf b/aws/alarms/cloudwatch_app.tf index a05ebf2db..6df6d3d8b 100644 --- a/aws/alarms/cloudwatch_app.tf +++ b/aws/alarms/cloudwatch_app.tf @@ -8,7 +8,7 @@ resource "aws_cloudwatch_metric_alarm" "forms_cpu_utilization_high_warn" { metric_name = "CPUUtilization" namespace = "AWS/ECS" period = "120" - statistic = "Average" + statistic = "Maximum" threshold = var.threshold_ecs_cpu_utilization_high alarm_description = "End User Forms Warning - High CPU usage has been detected." @@ -27,7 +27,7 @@ resource "aws_cloudwatch_metric_alarm" "forms_memory_utilization_high_warn" { metric_name = "MemoryUtilization" namespace = "AWS/ECS" period = "120" - statistic = "Average" + statistic = "Maximum" threshold = var.threshold_ecs_memory_utilization_high alarm_description = "End User Forms Warning - High memory usage has been detected." diff --git a/aws/alarms/cloudwatch_idp.tf b/aws/alarms/cloudwatch_idp.tf index 3b63bdc7b..77a202a58 100644 --- a/aws/alarms/cloudwatch_idp.tf +++ b/aws/alarms/cloudwatch_idp.tf @@ -11,7 +11,7 @@ resource "aws_cloudwatch_metric_alarm" "idp_cpu_utilization_high_warn" { metric_name = "CPUUtilization" namespace = "AWS/ECS" period = "120" - statistic = "Average" + statistic = "Maximum" threshold = var.threshold_ecs_cpu_utilization_high treat_missing_data = "notBreaching" @@ -34,7 +34,7 @@ resource "aws_cloudwatch_metric_alarm" "idp_memory_utilization_high_warn" { metric_name = "MemoryUtilization" namespace = "AWS/ECS" period = "120" - statistic = "Average" + statistic = "Maximum" threshold = var.threshold_ecs_memory_utilization_high treat_missing_data = "notBreaching"