I am using terraform as IAC,
I have the following policy:
resource "aws_appautoscaling_policy" "ecs_policy_cpu" {
name = "cpu-autoscaling"
policy_type = "TargetTrackingScaling"
resource_id = aws_appautoscaling_target.ecs_target.resource_id
scalable_dimension = aws_appautoscaling_target.ecs_target.scalable_dimension
service_namespace = aws_appautoscaling_target.ecs_target.service_namespace
target_tracking_scaling_policy_configuration {
predefined_metric_specification {
predefined_metric_type = "ECSServiceAverageCPUUtilization"
}
target_value = var.autoscaling_cpu_target
scale_in_cooldown = 120
scale_out_cooldown = 120
}
}
The ECS indeed has an autoscaling policy and I can observe that the system scale when the load is high, but the system do not scale down after the load end. After talking to the AWS support team it seems that terraform do not create the scale in policy( metric) only the scale out, did anyone encountered it?
thx