ng-implementation/ecs_autoscaling.tf
LEMOINE Baptiste - EXT-SAVANE CONSULTING GROUP (SAFRAN AIRCRAFT ENGINES) e31fdc2c02 up structure for tf
2025-09-19 10:09:31 +02:00

25 lines
No EOL
1.1 KiB
HCL

# 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
# }
# }