Creating Application Auto Scaling resources with AWS CloudFormation - Application Auto Scaling

Creating Application Auto Scaling resources with AWS CloudFormation

Application Auto Scaling is integrated with AWS CloudFormation, a service that helps you to model and set up your AWS resources so that you can spend less time creating and managing your resources and infrastructure. You create a template that describes all the AWS resources that you want, and AWS CloudFormation provisions and configures those resources for you.

When you use AWS CloudFormation, you can reuse your template to set up your Application Auto Scaling resources consistently and repeatedly. Describe your resources once, and then provision the same resources over and over in multiple AWS accounts and Regions.

Application Auto Scaling and AWS CloudFormation templates

To provision and configure resources for Application Auto Scaling and related services, you must understand AWS CloudFormation templates. Templates are formatted text files in JSON or YAML. These templates describe the resources that you want to provision in your AWS CloudFormation stacks. If you're unfamiliar with JSON or YAML, you can use AWS CloudFormation Designer to help you get started with AWS CloudFormation templates. For more information, see What is AWS CloudFormation Designer? in the AWS CloudFormation User Guide.

Application Auto Scaling supports creating scaling policies and scheduled actions in AWS CloudFormation. For more information, see the Application Auto Scaling reference in the AWS CloudFormation User Guide.

Example template snippets

We also provide a few JSON and YAML template snippets that you can use to understand how to declare various scaling policies and scheduled actions in your stack templates. For more information, see the Application Auto Scaling template examples page and the AWS::ApplicationAutoScaling::ScalingPolicy reference in the AWS CloudFormation User Guide.

When you create a stack template for Application Auto Scaling resources, you must provide the following:

  • A namespace for the target service (for example, appstream). See the AWS::ApplicationAutoScaling::ScalableTarget reference to obtain service namespaces.

  • A scalable dimension associated with the target resource (for example, appstream:fleet:DesiredCapacity). See the AWS::ApplicationAutoScaling::ScalableTarget reference to obtain scalable dimensions.

  • A resource ID for the target resource (for example, fleet/sample-fleet). See the AWS::ApplicationAutoScaling::ScalableTarget reference for information about the syntax and examples of specific resource IDs.

  • A service-linked role for the target resource (for example, arn:aws:iam::012345678910:role/aws-service-role/appstream.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_AppStreamFleet). See the Service-linked role ARN reference table to obtain role ARNs.

You can create stack templates that create scaling policies for any of the resources that Application Auto Scaling can scale. However, the types of scaling policies that the services support can differ. To find out which type of scaling policies are not supported for your service, see the PolicyType property in the AWS::ApplicationAutoScaling::ScalingPolicy reference.

Learn more about AWS CloudFormation

To learn more about AWS CloudFormation, see the following resources: