Skip to content

Auto Scaling

The Express Gateway Service
The aws_ecs_express_gateway_service Terraform resource that provisions an ECS service with managed ALB, auto scaling, and simplified configuration for HTTP/HTTPS web applications and APIs.
includes built-in target tracking auto scaling through the scaling_target block. Unlike classic ECS where you configure separate Application Auto Scaling resources, Express Mode handles the scaling infrastructure automatically.

main.tf
resource "aws_ecs_express_gateway_service" "this" {
# ...
scaling_target {
auto_scaling_metric = "CPU"
auto_scaling_target_value = 70
min_task_count = 1
max_task_count = 3
}
}
ParameterTypeAllowed ValuesSource Repo Value
auto_scaling_metricstring

“CPU”, “Memory"

"CPU”
auto_scaling_target_valuenumber1–100 (percentage)70
min_task_countnumber≥ 11
max_task_countnumber≥ min_task_count3

When you set auto_scaling_metric = "CPU" and auto_scaling_target_value = 70, Express Mode:

  1. Monitors average CPU utilization across all running tasks
  2. Adds tasks when average exceeds 70%
  3. Removes tasks when average drops below 70% (with cooldown)
  4. Maintains count between min_task_count and max_task_count

Classic ECS requires multiple resources for auto scaling:

  • aws_appautoscaling_target — registers the service as scalable
  • aws_appautoscaling_policy — defines the tracking policy
  • CloudWatch alarms — created automatically by the policy

With Express Mode, the scaling_target block replaces all of these. Express Mode also provisions the RollbackAlarm
A CloudWatch metric alarm created by Express Mode that triggers automatic deployment rollback when new tasks fail ALB health checks.
that triggers deployment rollback when new tasks fail health checks.