25 lines
1.1 KiB
Terraform
25 lines
1.1 KiB
Terraform
![]() |
# resource "aws_appautoscaling_target" "backend_autoscaling_target" {
|
||
|
# service_namespace = "ecs"
|
||
|
# resource_id = "service/${data.aws_ssm_parameter.ecs_cluster_id.value}/${aws_ecs_service.backend.name}"
|
||
|
# scalable_dimension = "ecs:service:DesiredCount"
|
||
|
# min_capacity = 1
|
||
|
# max_capacity = 3
|
||
|
# }
|
||
|
|
||
|
# resource "aws_appautoscaling_policy" "ecs_cpu_policy" {
|
||
|
# name = "ecs-cpu-scaling-policy"
|
||
|
# policy_type = "TargetTrackingScaling"
|
||
|
# resource_id = aws_appautoscaling_target.backend_autoscaling_target.resource_id
|
||
|
# scalable_dimension = aws_appautoscaling_target.backend_autoscaling_target.scalable_dimension
|
||
|
# service_namespace = aws_appautoscaling_target.backend_autoscaling_target.service_namespace
|
||
|
|
||
|
# target_tracking_scaling_policy_configuration {
|
||
|
# target_value = 90.0 # Scale when CPU exceeds 90%
|
||
|
# predefined_metric_specification {
|
||
|
# predefined_metric_type = "ECSServiceAverageCPUUtilization"
|
||
|
# }
|
||
|
|
||
|
# scale_in_cooldown = 300 # Wait 5 mins before scaling down
|
||
|
# scale_out_cooldown = 60 # Wait 1 min before scaling up
|
||
|
# }
|
||
|
# }
|