Other Articles

ECS Service – Enable Auto Scaling

Secure Configuration Checks > AWS

This check ensures that auto scaling is enabled for Amazon ECS services. Enabling auto scaling allows ECS services to automatically adjust the number of running tasks based on workload demand, improving availability and performance while reducing the risk of service outages.

Check Details

  • Resource: ECS Service
  • Check: Enable auto scaling for ECS service
  • Risk: Service may fail under high load or waste resources during low demand

Remediation via AWS Console

  1. Log in to the AWS Management Console and open the Amazon ECS console.

    Amazon ECS Console
  2. Navigate to Clusters and select your ECS cluster. Amazon ECS Cluster
  3. Navigate to the Services tab and select the ECS service.
  4. Select the target ECS service and click the Update button. Amazon ECS Service
  5. Scroll down to the Service Auto Scaling section. Amazon ECS Service
  6. Check the option Use service auto scaling.
    Configure scaling settings:

    • Set Minimum tasks (e.g., 1)
    • Set Maximum tasks (e.g., 4)

    The desired task count is automatically managed by the scaling policy based on the defined limits.

  7. Add a scaling policy (recommended: Target Tracking):

    • Select Target tracking as the scaling policy type
    • Enter a Policy name (e.g., cpu-scaling-policy)
    • Choose ECSServiceAverageCPUUtilization as the metric
    • Set Target value (e.g., 70%)
    • Configure Scale-out cooldown period (e.g., 300 seconds)
    • Configure Scale-in cooldown period (e.g., 300 seconds)
    ECS Scaling Policy
  8. Click Update Service to apply changes.

Remediation via AWS CLI

  1. Open AWS CloudShell or your terminal with configured AWS CLI.

  2. Register the ECS service as a scalable target:

    aws application-autoscaling register-scalable-target \
    --service-namespace ecs \
    --resource-id service/<cluster-name>/<service-name> \
    --scalable-dimension ecs:service:DesiredCount \
    --min-capacity 1 \
    --max-capacity 4
    
  3. Create a target tracking scaling policy:

    aws application-autoscaling put-scaling-policy \
    --service-namespace ecs \
    --resource-id service/<cluster-name>/<service-name> \
    --scalable-dimension ecs:service:DesiredCount \
    --policy-name cpu-scaling-policy \
    --policy-type TargetTrackingScaling \
    --target-tracking-scaling-policy-configuration '{
      "TargetValue": 70.0,
      "PredefinedMetricSpecification": {
        "PredefinedMetricType": "ECSServiceAverageCPUUtilization"
      }
    }'
    

Replace <cluster-name> and <service-name> with your ECS cluster and service names.

Updated on 23 April, 2026