hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.86k stars 9.2k forks source link

[Enhancement]: Predictive scaling policies for ECS #40328

Open angusjellis opened 17 hours ago

angusjellis commented 17 hours ago

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

github-actions[bot] commented 17 hours ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

angusjellis commented 17 hours ago

I would be interested in working on this myself, but I likely wouldn't be able to get started until this weekend.