A rolling update replaces EC2 instances rather than changing software on running machines. AWS CloudFormation can orchestrate the replacement through an Auto Scaling group: launch a new instance from an updated launch template, run its deployment script, then terminate the old instance. This approach is intended to keep the application available during deployment. section 15.2 section 15.1
Use this pattern when instances are disposable: the application must not depend on data retained only on an instance’s local disk or in memory. Starting each deployment on a new machine avoids surprises caused by earlier changes to a long-running server. An Application Load Balancer forwards requests to the web application, while the Auto Scaling group manages its EC2 instances. section 15.2 section 15.1 section 15.0
To roll out an Etherpad version:
- Deploy a CloudFormation stack with `EtherpadVersion=1.8.17`. Its launch template supplies user data that installs dependencies, fetches and configures Etherpad, and starts it. section 15.2
- Change the version parameter to `EtherpadVersion=1.8.18` and deploy the stack again. CloudFormation updates the launch template and orchestrates replacement through the Auto Scaling group. section 15.2
- Open the stack’s application URL to check the deployed version. If startup fails, inspect `/var/log/cloud-init-output.log` on the instance. section 15.2
Listing 15.5 Updating the Auto Scaling group or the referenced launch template
AutoScalingGroup: #1
Type: 'AWS::AutoScaling::AutoScalingGroup'
Properties:
TargetGroupARNs:
- !Ref LoadBalancerTargetGroup
LaunchTemplate: #2
LaunchTemplateId: !Ref LaunchTemplate
Version: !GetAtt 'LaunchTemplate.LatestVersionNumber'
MinSize: '1' #3
MaxSize: '2' #4
HealthCheckGracePeriod: 300
HealthCheckType: ELB
VPCZoneIdentifier:
- !Ref SubnetA
- !Ref SubnetB
Tags:
- PropagateAtLaunch: true
Value: etherpad
Key: Name
CreationPolicy:
ResourceSignal:
Timeout: PT10M
UpdatePolicy: #5
AutoScalingRollingUpdate: #6
PauseTime: PT10M #7
WaitOnResourceSignals: true #8
MinInstancesInService: 1 #9
The Auto Scaling group references the launch template’s latest version and declares an `AutoScalingRollingUpdate` policy. Its example configuration allows one or two instances, providing room to launch a replacement before removing the old one. section 15.2
A rolling update trades the speed of changing an existing instance for a fresh start on each deployment. Unlike an in-place CodeDeploy deployment, it does not require modifying a long-running machine; unlike an immutable deployment built with Packer, this example installs and configures the application at boot through user data. section 15.1 section 15.2 section 15.5







