Difference between revisions of "Terraform resource: aws appautoscaling policy"

From wikieduonline
Jump to navigation Jump to search
 
(3 intermediate revisions by one other user not shown)
Line 7: Line 7:
 
   max_capacity      = 4
 
   max_capacity      = 4
 
   min_capacity      = 1
 
   min_capacity      = 1
   resource_id        = "service/clusterName/serviceName"
+
   [[resource_id]]       = "service/clusterName/serviceName"
 
   scalable_dimension = "ecs:service:DesiredCount"
 
   scalable_dimension = "ecs:service:DesiredCount"
 
   service_namespace  = "ecs"
 
   service_namespace  = "ecs"
Line 18: Line 18:
 
   scalable_dimension = aws_appautoscaling_target.ecs_target.scalable_dimension
 
   scalable_dimension = aws_appautoscaling_target.ecs_target.scalable_dimension
 
   service_namespace  = aws_appautoscaling_target.ecs_target.service_namespace
 
   service_namespace  = aws_appautoscaling_target.ecs_target.service_namespace
 
+
 
   step_scaling_policy_configuration {
 
   step_scaling_policy_configuration {
 
     adjustment_type        = "ChangeInCapacity"
 
     adjustment_type        = "ChangeInCapacity"
 
     cooldown                = 60
 
     cooldown                = 60
 
     metric_aggregation_type = "Maximum"
 
     metric_aggregation_type = "Maximum"
 
+
 
     step_adjustment {
 
     step_adjustment {
 
       metric_interval_upper_bound = 0
 
       metric_interval_upper_bound = 0
Line 30: Line 30:
 
   }
 
   }
 
  }
 
  }
 +
 +
== Related ==
 +
* [[Terraform DynamoDB]]
 +
* <code>[[aws_appautoscaling_target]]</code>
  
 
== See also ==
 
== See also ==

Latest revision as of 08:38, 4 July 2023

  • aws_appautoscaling_policy[1]

ECS Example[edit]

resource "aws_appautoscaling_target" "ecs_target" {
 max_capacity       = 4
 min_capacity       = 1
 resource_id        = "service/clusterName/serviceName"
 scalable_dimension = "ecs:service:DesiredCount"
 service_namespace  = "ecs"
}
resource "aws_appautoscaling_policy" "ecs_policy" {
 name               = "scale-down"
 policy_type        = "StepScaling"
 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

 step_scaling_policy_configuration {
   adjustment_type         = "ChangeInCapacity"
   cooldown                = 60
   metric_aggregation_type = "Maximum"

   step_adjustment {
     metric_interval_upper_bound = 0
     scaling_adjustment          = -1
   }
 }
}

Related[edit]

See also[edit]

  • https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/appautoscaling_policy
  • Advertising: