Cloud/Terraform

Terraform - Auto Scaling Tracking Policy 생성 및 Load Test로 Auto Scaling 테스트

잇(IT) 2022. 7. 10. 11:57

resource "aws_autoscaling_policy" "bat" {
  name                   = "foobar3-terraform-test"
  scaling_adjustment     = 4
  adjustment_type        = "ChangeInCapacity"
  cooldown               = 300
  autoscaling_group_name = aws_autoscaling_group.bar.name
}

target_tracking_configuration {
    predefined_metric_specification {
      predefined_metric_type = "ASGAverageCPUUtilization"
    }

    target_value = 40.0
  }

 

- asg-target-tracking-policy 전체 코드

resource "aws_autoscaling_policy" "target-tracking-policy" {
  name                   = "target-tracking-policy"
  policy_type            = "TargetTrackingScaling"
  estimated_instance_warmup = 60
  autoscaling_group_name = aws_autoscaling_group.tf-asg.name
   
   target_tracking_configuration {
    predefined_metric_specification {
      predefined_metric_type = "ASGAverageCPUUtilization"
    }

    target_value = 40.0
    }
  }

728x90