terraform-provider-aws icon indicating copy to clipboard operation
terraform-provider-aws copied to clipboard

[Enhancement]: Predictive scaling policies for ECS

Open angusjellis opened this issue 2 months ago • 3 comments

Description

AWS recently announced a new feature: ECS Predictive Scaling Policies. They use the App Autoscaling API behind the scenes (according to the docs - see the CLI documentation).

It looks like this change would require adding PredictiveScaling as a valid option to Policy_Type.

A new predictive_scaling_configuration configuration block would also need to be added - perhaps taking as inspiration what has been set up for EC2 auto scaling.

Affected Resource(s) and/or Data Source(s)

aws_appautoscaling_policy

Potential Terraform Configuration

resource "aws_appautoscaling_policy" "ecs_policy" {
  name               = "PredictiveScalingPolicy"
  policy_type        = "PredictiveScaling"
  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

  predictive_scaling_configuration {
    metric_specifications =  [
        {
            target_value = 40,
            predefined_metric_pair_specification {
                predefined_metric_type =  "ECSServiceMemoryUtilization"
            }
        }
    ]
    scheduling_buffer_time =  3600
    max_capacity_breach_behavior =  "HonorMaxCapacity"
    mode = "ForecastOnly"
}
}

References

No response

Would you like to implement a fix?

Yes

angusjellis avatar Nov 27 '24 12:11 angusjellis