How do I trigger rolling updates when there are no changes to the launch configuration in AWS CloudFormation?

Last updated: 2019-05-20

If I update my AWS CloudFormation stack, the instances in the Auto Scaling group don't update, because I'm not modifying the launch configuration. However, I want to trigger rolling updates in my Auto Scaling group on every update of the stack, even if I don't modify the launch configuration.

Short Description

Rolling updates for an Auto Scaling group are triggered only if specific conditions of the UpdatePolicy attribute are met.

To trigger rolling updates, you can create a triggering parameter (Toggle, in this example) in the launch configuration of your AWS CloudFormation template. However, if you change the value of the Toggle parameter during a stack update, the UserData property is modified. Any modification to UserData requires replacement. AWS CloudFormation detects the modification to UserData, and then replaces the LaunchConfiguration resource. This replacement triggers the Auto Scaling rolling update as defined by the UpdatePolicy attribute.


The following steps assume that your AutoScalingRollingUpdate policy is configured for your Auto Scaling group and that your Auto Scaling group is configured to reference LaunchConfiguration.

Important: Be careful not to disrupt other elements in the UserData property when you add the Toggle parameter to your template. Don't add the Toggle parameter before cfn-signal.

1.    In your AWS CloudFormation template, define your parameter (Toggle for this example). See the following JSON and YAML examples.


"Parameters": {
        "Toggle": {
            "Type": "String",
            "AllowedValues": ["true","false"],
            "Default": "true"


    Type: String
      - 'true'
      - 'false'
    Default: 'true'

2.    In the launch configuration of your template, reference Toggle in the UserData property, and then launch your stack. See the following JSON and YAML examples.


"LaunchConfig" : {
   "Type" : "AWS::AutoScaling::LaunchConfiguration",
   "Properties" : {
         "ImageId" : { "Ref" : "ImageID" },
         "UserData" : { "Fn::Base64" : { "Ref" : "Toggle" }
         "InstanceType" : { "Ref" : "Type" }


  Type: 'AWS::AutoScaling::LaunchConfiguration'
    ImageId: !Ref ImageID
      'Fn::Base64': !Ref Toggle
    InstanceType: !Ref Type

Important: To trigger rolling updates when you update your stack, change the value of the Toggle parameter from true to false or false to true depending on its initial setting before launching the stack.

Note: You can use the Toggle parameter solution on properties where an update requires replacement (such as LaunchConfigurationName) and for resources like AWS::EC2::LaunchTemplate.

Did this article help you?

Anything we could improve?

Need more help?