AWS CloudFormation
User Guide (Version )

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

AWS::AutoScalingPlans::ScalingPlan

The AWS::AutoScalingPlans::ScalingPlan resource defines a scaling plan that AWS Auto Scaling uses to scale the following application resources:

  • Amazon EC2 Auto Scaling groups

  • Amazon EC2 Spot Fleet requests

  • Amazon ECS services

  • Amazon DynamoDB tables and global secondary indexes

  • Amazon Aurora Replicas

For more information, see the AWS Auto Scaling User Guide.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::AutoScalingPlans::ScalingPlan", "Properties" : { "ApplicationSource" : ApplicationSource, "ScalingInstructions" : [ ScalingInstruction, ... ] } }

YAML

Type: AWS::AutoScalingPlans::ScalingPlan Properties: ApplicationSource: ApplicationSource ScalingInstructions: - ScalingInstruction

Properties

ApplicationSource

A CloudFormation stack or a set of tags. You can create one scaling plan per application source.

Required: Yes

Type: ApplicationSource

Update requires: No interruption

ScalingInstructions

The scaling instructions.

Required: Yes

Type: List of ScalingInstruction

Update requires: No interruption

Return Values

Ref

When you pass the logical ID of an AWS::AutoScalingPlans::ScalingPlan resource to the intrinsic Ref function, the function returns the Amazon Resource Name (ARN) of the scaling plan. The format of the ARN is as follows:

arn:aws:autoscaling:region:123456789012:scalingPlan:scalingPlanName/plan-name:scalingPlanVersion/plan-version

For more information about using the Ref function, see Ref.

Examples

Scaling Plan

The following example creates a scaling plan named myScalingPlan for an existing Auto Scaling group whose name you specify (along with other values) when launching the stack using this template. It specifies the TagFilters property as the application source and enables predictive scaling and dynamic scaling.

JSON

{ "AWSTemplateFormatVersion":"2010-09-09", "Parameters":{ "myTagKey":{ "Type":"String" }, "myTagValue":{ "Type":"String" }, "myASGroup":{ "Type":"String", "Description":"Name of the Auto Scaling group" }, "ASGMinCapacity":{ "Type":"Number" }, "ASGMaxCapacity":{ "Type":"Number" }, "ASGTargetUtilization":{ "Type":"Number", "Default":"50.0" }, "ASGEstimatedInstanceWarmup":{ "Type":"Number", "Default":"600" } }, "Resources":{ "myScalingPlan":{ "Type":"AWS::AutoScalingPlans::ScalingPlan", "Properties":{ "ApplicationSource":{ "TagFilters":[ { "Key":{ "Ref":"myTagKey" }, "Values":[{ "Ref":"myTagValue" }] } ] }, "ScalingInstructions":[ { "MinCapacity":{ "Ref":"ASGMinCapacity" }, "MaxCapacity":{ "Ref":"ASGMaxCapacity" }, "ServiceNamespace":"autoscaling", "ScalableDimension":"autoscaling:autoScalingGroup:DesiredCapacity", "ResourceId":{ "Fn::Join":[ "/", [ "autoScalingGroup", { "Ref":"myASGroup" } ] ] }, "TargetTrackingConfigurations":[ { "PredefinedScalingMetricSpecification":{ "PredefinedScalingMetricType":"ASGAverageCPUUtilization" }, "TargetValue":{ "Ref":"ASGTargetUtilization" }, "EstimatedInstanceWarmup":{ "Ref":"ASGEstimatedInstanceWarmup" } } ], "PredefinedLoadMetricSpecification":{ "PredefinedLoadMetricType":"ASGTotalCPUUtilization" }, "PredictiveScalingMode":"ForecastAndScale", "PredictiveScalingMaxCapacityBehavior":"SetMaxCapacityAboveForecastCapacity", "PredictiveScalingMaxCapacityBuffer":25, "ScheduledActionBufferTime":600 } ] } } } }

YAML

AWSTemplateFormatVersion: 2010-09-09 Parameters: myTagKey: Type: String myTagValue: Type: String myASGroup: Type: String Description: Name of the Auto Scaling group ASGMinCapacity: Type: Number ASGMaxCapacity: Type: Number ASGTargetUtilization: Type: Number Default: 50.0 ASGEstimatedInstanceWarmup: Type: Number Default: 600 Resources: myScalingPlan: Type: AWS::AutoScalingPlans::ScalingPlan Properties: ApplicationSource: TagFilters: - Key: !Ref myTagKey Values: - !Ref myTagValue ScalingInstructions: - MinCapacity: !Ref ASGMinCapacity MaxCapacity: !Ref ASGMaxCapacity ServiceNamespace: autoscaling ScalableDimension: autoscaling:autoScalingGroup:DesiredCapacity ResourceId: !Join - / - - autoScalingGroup - !Ref myASGroup TargetTrackingConfigurations: - PredefinedScalingMetricSpecification: PredefinedScalingMetricType: "ASGAverageCPUUtilization" TargetValue: !Ref ASGTargetUtilization EstimatedInstanceWarmup: !Ref ASGEstimatedInstanceWarmup PredefinedLoadMetricSpecification: PredefinedLoadMetricType: "ASGTotalCPUUtilization" PredictiveScalingMode: "ForecastAndScale" PredictiveScalingMaxCapacityBehavior: "SetMaxCapacityAboveForecastCapacity" PredictiveScalingMaxCapacityBuffer: 25 ScheduledActionBufferTime: 600