File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed
infrastructure/environments/test/fake-api/modules/ecs-service Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -225,3 +225,21 @@ resource "aws_appautoscaling_policy" "scale_down" {
225225 }
226226 }
227227}
228+
229+ resource "aws_appautoscaling_policy" "cpu_scaling" {
230+ name = " ${ var . name } -cpu-scaling"
231+ policy_type = " TargetTrackingScaling"
232+ resource_id = aws_appautoscaling_target. main . resource_id
233+ scalable_dimension = aws_appautoscaling_target. main . scalable_dimension
234+ service_namespace = aws_appautoscaling_target. main . service_namespace
235+
236+ target_tracking_scaling_policy_configuration {
237+ target_value = var. cpu_target
238+ scale_out_cooldown = var. cpu_target_scale_out_cooldown
239+ scale_in_cooldown = var. cpu_target_scale_in_cooldown
240+
241+ predefined_metric_specification {
242+ predefined_metric_type = " ECSServiceAverageCPUUtilization"
243+ }
244+ }
245+ }
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ variable "min_capacity" {
9090variable "max_capacity" {
9191 description = " The maximum number of tasks for the service."
9292 type = number
93- default = 5
93+ default = 16
9494}
9595variable "scale_up_threshold_ms" {
9696 description = " The average response time in milliseconds to trigger a scale-up event."
@@ -102,3 +102,18 @@ variable "scale_down_threshold_ms" {
102102 type = number
103103 default = 200
104104}
105+ variable "cpu_target" {
106+ description = " Target CPU utilization percentage"
107+ type = number
108+ default = 75
109+ }
110+ variable "cpu_target_scale_out_cooldown" {
111+ description = " Seconds to wait before another CPU target scale-out activity"
112+ type = number
113+ default = 30
114+ }
115+ variable "cpu_target_scale_in_cooldown" {
116+ description = " Seconds to wait before another CPU target scale-in activity"
117+ type = number
118+ default = 300
119+ }
You can’t perform that action at this time.
0 commit comments