aws application-autoscaling register-scalable-target \
--service-namespace ecs \
--scalable-dimension ecs:service:DesiredCount \
--resource-id service/YOUR_CLUSTER_NAME/YOUR_SERVICE_NAME \
--min-capacity 1 \
--max-capacity 10
aws application-autoscaling put-scaling-policy \
--policy-name "alb-requests-per-minute-policy" \
--service-namespace ecs \
--scalable-dimension ecs:service:DesiredCount \
--resource-id service/YOUR_CLUSTER_NAME/YOUR_SERVICE_NAME \
--policy-type TargetTrackingScaling \
--target-tracking-scaling-policy-configuration '{
"TargetValue": 500.0,
"PredefinedMetricSpecification": {
"PredefinedMetricType": "ALBRequestCountPerTarget",
"ResourceLabel": "YOUR_ALB_AND_TARGET_GROUP_LABEL"
},
"ScaleOutCooldown": 60,
"ScaleInCooldown": 300
}'