AWS CloudFormation
User Guide (API Version 2010-05-15)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

AWS::AutoScaling::AutoScalingGroup

The AWS::AutoScaling::AutoScalingGroup type creates an Auto Scaling group.

You can add an UpdatePolicy to your auto-scaling group to control how updates are made when a change has been made to either the launch configuration or subnet group membership of the auto scaling group.

Caution

When you update the LoadBalancerNames property, AWS CloudFormation first creates a replacement auto scaling group resource with a new physical name, changes references from other dependent resources to point to the replacement resource, and then deletes the old resource.

Syntax

{
   "Type" : "AWS::AutoScaling::AutoScalingGroup",
   "Properties" : {
      "AvailabilityZones" : [ String, ... ],
      "Cooldown" : String,
      "DesiredCapacity" : String,
      "HealthCheckGracePeriod" : Integer,
      "HealthCheckType" : String,
      "LaunchConfigurationName" : String,
      "LoadBalancerNames : [ String, ... ],
      "MaxSize" : String,
      "MinSize" : String,
      "NotificationConfiguration" : NotificationConfiguration,
      "Tags" : [ Auto Scaling Tag, ..., ],
      "VPCZoneIdentifier" : [ String, ... ]
   }
}     

Properties

AvailabilityZones

Contains a list of availability zones for the group.

Required: Yes.

Type: A list of strings.

Cooldown

The number of seconds after a scaling activity completes before any further scaling activities can start.

Required: No.

Type: String.

DesiredCapacity

Specifies the desired capacity for the auto scaling group.

If SpotPrice is not set in the AWS::AutoScaling::LaunchConfiguration for this auto scaling group, then Auto Scaling will begin to bring up instances based on DesiredCapacity. CloudFormation will not mark the auto scaling group as successful (by setting its status to CREATE_COMPLETE) until the desired capacity is reached.

If SpotPrice is set, then DesiredCapacity will not be used as a criteria for success, since instances will only be run when the spot price has been matched. Once the spot price has been matched, however, Auto Scaling will use DesiredCapacity as the target capacity for bringing up instances.

Required: No.

Type: String.

HealthCheckGracePeriod

The length of time in seconds after a new EC2 instance comes into service that Auto Scaling starts checking its health.

Required: No.

Type: Integer

HealthCheckType

The service you want the health status from, Amazon EC2 or Elastic Load Balancer. Valid values are "EC2" or "ELB."

Required: No.

Type: String.

LaunchConfigurationName

Specifies the name of the associated AWS::AutoScaling::LaunchConfiguration.

Required: Yes.

Type: String.

Update requires: replacement

LoadBalancerNames

A list of load balancers associated with this auto scaling group.

Required: No.

Type: List of Strings

Update requires: replacement

MaxSize

The maximum size of the auto scaling group.

Required: Yes.

Type: String.

MinSize

The minimum size of the auto scaling group.

Required: Yes.

Type: String.

NotificationConfiguration

An embedded property that configures an auto scaling group to send notifications when specified events take place.

Required: No.

Type: NotificationConfiguration

Tags

The tags you want to attach to this resource.

For more information about tags, go to Tagging Auto Scaling Groups and Amazon EC2 Instances in the Auto Scaling Developer Guide.

Required: Yes.

Type: List of Auto Scaling Tags

Update requires: no interruption

VPCZoneIdentifier

A list of subnet identifiers of Amazon Virtual Private Clouds (Amazon VPCs).

The subnets that you specify for VPCZoneIdentifier must reside in the availability zones that you specify with the AvailabilityZones parameter.

For more information, go to Using EC2 Dedicated Instances Within Your VPC in the Auto Scaling Developer Guide.

Update requires: replacement

Required: No.

Type: A list of strings.

Return Value

When the logical ID of this resource is provided to the Ref intrinsic function, it returns the resource name. For example:

{ "Ref": "MyASGroup" }

For an auto scaling group with the logical ID "MyASGroup", Ref will return:

arn:aws:cloudformation:us-east-1:803981987763:stack/mystack-myembeddedstack-sggfrhxhum7w/f449b250-b969-11e0-a185-5081d0136786

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

Examples

Auto scaling group with an elastic load balancer and launch configuration

"WebServerGroup" : {
   "Type" : "AWS::AutoScaling::AutoScalingGroup",
   "Properties" : {
      "AvailabilityZones" : { "Fn::GetAZs" : "" },
      "LaunchConfigurationName" : { "Ref" : "LaunchConfig" },
      "MinSize" : "2",
      "MaxSize" : "2",
      "LoadBalancerNames" : [ { "Ref" : "ElasticLoadBalancer" } ]
   }
}        

Auto scaling group with an update policy

"ASG1" : {
   "UpdatePolicy" : {
      "AutoScalingRollingUpdate" : {
         "MinInstancesInService" : "1",
         "MaxBatchSize" : "1",
         "PauseTime" : "PT12M5S"
      }
   },
   "Type" : "AWS::AutoScaling::AutoScalingGroup",
   "Properties" : {
      "AvailabilityZones" : { "Fn::GetAZs" : { "Ref" : "AWS::Region" } },
      "LaunchConfigurationName" : { "Ref" : "ASLC" },
      "MaxSize" : "3",
      "MinSize" : "1"
   }
}

To view more auto-scaling examples, see Auto Scaling Snippets.