From 48036b2399945d52bf7636cac034c3e7ac5a818c Mon Sep 17 00:00:00 2001 From: lauren_tb Date: Fri, 9 Aug 2024 12:04:22 +0100 Subject: [PATCH] added cooldown to ecs policy --- modules/ecs_auto_scaling_radius/main.tf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/ecs_auto_scaling_radius/main.tf b/modules/ecs_auto_scaling_radius/main.tf index 38d9cd0..35aaae9 100644 --- a/modules/ecs_auto_scaling_radius/main.tf +++ b/modules/ecs_auto_scaling_radius/main.tf @@ -16,6 +16,7 @@ resource "aws_appautoscaling_policy" "ecs_policy_up" { step_scaling_policy_configuration { adjustment_type = "ChangeInCapacity" metric_aggregation_type = "Average" + cooldown = 300 step_adjustment { metric_interval_lower_bound = 0 @@ -254,15 +255,15 @@ resource "aws_cloudwatch_metric_alarm" "cpu_utilization_alarm" { metric_name = "CPUUtilization" namespace = "AWS/ECS" period = "60" - statistic = "Average" - threshold = "80" + statistic = "Maximum" + threshold = "90" dimensions = { ClusterName = var.cluster_name ServiceName = var.service_name } - alarm_description = "This alarm tells ECS to scale up based on CPU utilisation with Average statistics" + alarm_description = "This alarm tells ECS to scale up based on CPU utilisation with Maximum statistics" alarm_actions = [ aws_appautoscaling_policy.ecs_policy_up.arn