Create a predictive scaling policy for Application Auto Scaling
The following example policy uses the Amazon CLI to configure a predictive scaling policy for Amazon ECS service. Replace
each user input placeholder
with your own information.
For more information about the CloudWatch metrics you can specify, see PredictiveScalingMetricSpecification in the Amazon EC2 Auto Scaling API Reference.
The following is an example policy with a predefined memory configuration.
cat policy.json { "MetricSpecifications": [ { "TargetValue":
40
, "PredefinedMetricPairSpecification": { "PredefinedMetricType": "ECSServiceMemoryUtilization
" } } ], "SchedulingBufferTime":3600
, "MaxCapacityBreachBehavior": "HonorMaxCapacity", "Mode": "ForecastOnly" }
The following example illustrates creating the policy by running the put-scaling-policy
aws aas put-scaling-policy \ --service-namespace
ecs
\ --regionus-east-1
\ --policy-namepredictive-scaling-policy-example
\ --resource-idservice/MyCluster/test
\ --policy-type PredictiveScaling \ --scalable-dimension ecs:service:DesiredCount \ --predictive-scaling-policy-configuration file://policy.json
If successful, this command returns the policy's ARN.
{
"PolicyARN": "arn:aws:autoscaling:us-east-1:012345678912:scalingPolicy:d1d72dfe-5fd3-464f-83cf-824f16cb88b7:resource/ecs/service/MyCluster/test:policyName/predictive-scaling-policy-example",
"Alarms": []
}