Create a predictive scaling policy for Application Auto Scaling - Application Auto Scaling
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

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 command with the configuration file specified.

aws aas put-scaling-policy \ --service-namespace ecs \ --region us-east-1 \ --policy-name predictive-scaling-policy-example \ --resource-id service/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": [] }