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...

UpdatePolicy Attribute

The UpdatePolicy attribute enables you to specify how AWS CloudFormation handles rolling updates for a particular resource.

Currently, the only AWS CloudFormation resource that supports update policies is AWS::AutoScaling::AutoScalingGroup. For auto scaling groups, the update policy is invoked by a change in the launch configuration or in the subnet group membership of the auto scaling group.

Important

If you have rolling updates and scheduled actions enabled, you must suspend scheduled actions before you can update the Auto Scaling group. You can suspend processes by using the AWS CLI or Auto Scaling API. For more information, see Suspend and Resume Auto Scaling Process in the Auto Scaling Developer Guide.

Syntax

"UpdatePolicy" : {
   "AutoScalingRollingUpdate" : {
      "MaxBatchSize" : String,
      "MinInstancesInService" : String,
      "PauseTime" : String
   }
}     

UpdatePolicy Options

UpdatePolicy contains an AutoScalingRollingUpdate embedded object that specifies the following policy settings:

MaxBatchSize

The maximum number of instances that are terminated at a given time.

Type: String

Required: No The default value is one ("1").

MinInstancesInService

The minimum number of instances that must be in service within the auto-scaling group while obsolete instances are being terminated.

Type: String

Required: No The default value is zero ("0").

PauseTime

The amount of time to pause before changes are made to a resource, for example, before adding or removing auto-scaling instances when scaling up or terminating instances in an auto-scaling group.

The value must be in ISO8601 duration format, in the form: "PT#H#M#S", where each # is the number of hours, minutes, and/or seconds, respectively. The maximum amount of time that can be specified for the pause time is one hour ("PT1H").

Type: String

Required: No The default value is zero seconds ("PT0S").

Example

The following example shows how to add an update policy to an auto-scaling group.

"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"
   }
}