DEV Community

Cover image for Day 11: Scaling ECS: Auto Scaling and Capacity Providers
Pragnesh Patel
Pragnesh Patel

Posted on

Day 11: Scaling ECS: Auto Scaling and Capacity Providers

From Day 10, scale dynamically.

Service Auto Scaling

Console: Service > Update > Scaling > Set min/max/desired.

Policy: Target tracking on CPU (e.g., 70%).

TG

CLI example:

aws application-autoscaling register-scalable-target --service-namespace ecs --resource-id service/my-cluster/my-service --scalable-dimension ecs:service:DesiredCount --min-capacity 1 --max-capacity 10

aws application-autoscaling put-scaling-policy --policy-name cpu70 --service-namespace ecs --resource-id service/my-cluster/my-service --scalable-dimension ecs:service:DesiredCount --policy-type TargetTrackingScaling --target-tracking-scaling-policy-configuration '{ "TargetValue": 70, "PredefinedMetricSpecification": { "PredefinedMetricType": "ECSServiceAverageCPUUtilization" } }'
Enter fullscreen mode Exit fullscreen mode

Capacity Providers (EC2)

For EC2 launch type: Create ASG, then capacity provider.

For Fargate, auto-handled.

Test: Use tools like Apache Bench to load test.

Today’s Takeaway

Scalable services!

What’s Next?
In Day 12, we’ll monitor with CloudWatch.

Top comments (0)