Skip to content

Commit

Permalink
AUT-2487-Removing old ecs scaling policy post switched to step scaling (
Browse files Browse the repository at this point in the history
#1436)

* Removed old ecs scaling policy as we switched to step scaling after perf test
  • Loading branch information
pskushwaha1 authored Mar 6, 2024
1 parent 5c41e2b commit 66373a6
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 50 deletions.
45 changes: 1 addition & 44 deletions ci/terraform/auto-scaling.tf
Original file line number Diff line number Diff line change
@@ -1,49 +1,6 @@

# TODO: fully replace frontend_auto_scaling_* with frontend_auto_scaling_*_v2 after performance testing
resource "aws_appautoscaling_target" "frontend_auto_scaling_target" {
count = var.frontend_auto_scaling_enabled ? 1 : 0
min_capacity = var.frontend_auto_scaling_min_count
max_capacity = var.frontend_auto_scaling_max_count
resource_id = "service/${var.environment}-app-cluster/${aws_ecs_service.frontend_ecs_service.name}"
scalable_dimension = "ecs:service:DesiredCount"
service_namespace = "ecs"
}
# stepscaling frontend_auto_scaling_*_v2 after performance testing

resource "aws_appautoscaling_policy" "frontend_auto_scaling_policy_memory" {
count = var.frontend_auto_scaling_enabled ? 1 : 0
name = "${var.environment}-frontend_auto_scaling_policy_memory"
policy_type = "TargetTrackingScaling"
resource_id = aws_appautoscaling_target.frontend_auto_scaling_target[0].resource_id
scalable_dimension = aws_appautoscaling_target.frontend_auto_scaling_target[0].scalable_dimension
service_namespace = aws_appautoscaling_target.frontend_auto_scaling_target[0].service_namespace

target_tracking_scaling_policy_configuration {
predefined_metric_specification {
predefined_metric_type = "ECSServiceAverageMemoryUtilization"
}
target_value = var.frontend_auto_scaling_policy_memory_target
scale_out_cooldown = var.frontend_auto_scaling_policy_scale_out_cooldown
scale_in_cooldown = var.frontend_auto_scaling_policy_scale_in_cooldown
}
}

resource "aws_appautoscaling_policy" "frontend_auto_scaling_policy_cpu" {
count = var.frontend_auto_scaling_enabled ? 1 : 0
name = "${var.environment}-frontend_auto_scaling_policy_cpu"
policy_type = "TargetTrackingScaling"
resource_id = aws_appautoscaling_target.frontend_auto_scaling_target[0].resource_id
scalable_dimension = aws_appautoscaling_target.frontend_auto_scaling_target[0].scalable_dimension
service_namespace = aws_appautoscaling_target.frontend_auto_scaling_target[0].service_namespace

target_tracking_scaling_policy_configuration {
predefined_metric_specification {
predefined_metric_type = "ECSServiceAverageCPUUtilization"
}
target_value = var.frontend_auto_scaling_policy_cpu_target
scale_out_cooldown = var.frontend_auto_scaling_policy_scale_out_cooldown
scale_in_cooldown = var.frontend_auto_scaling_policy_scale_in_cooldown
}
}

resource "aws_cloudwatch_metric_alarm" "ecs_service_scale_out_alarm" {
count = var.frontend_auto_scaling_v2_enabled ? 1 : 0
Expand Down
1 change: 0 additions & 1 deletion ci/terraform/integration.tfvars
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
environment = "integration"
common_state_bucket = "digital-identity-dev-tfstate"

frontend_auto_scaling_enabled = false
frontend_auto_scaling_v2_enabled = true
frontend_task_definition_cpu = 512
frontend_task_definition_memory = 1024
Expand Down
1 change: 0 additions & 1 deletion ci/terraform/production.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ environment = "production"
common_state_bucket = "digital-identity-prod-tfstate"
redis_node_size = "cache.m4.xlarge"

frontend_auto_scaling_enabled = false
frontend_auto_scaling_v2_enabled = true
frontend_task_definition_cpu = 512
frontend_task_definition_memory = 1024
Expand Down
4 changes: 0 additions & 4 deletions ci/terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ variable "frontend_task_definition_memory" {
default = 2048
}

variable "frontend_auto_scaling_enabled" {
default = false
}

variable "frontend_auto_scaling_v2_enabled" {
default = false
}
Expand Down

0 comments on commit 66373a6

Please sign in to comment.