In this test we went from application version ABC
to XYZ
in the stacks:
BasicAsgRollingUpdate
(CFN stackplayground-CODE-basic-asg-rolling-update
)NoDesiredAsgRollingUpdate
(CFN stackplayground-CODE-no-desired-asg-rolling-update
)
The main aim of this test was to establish whether setting desired capacity in the CloudFormation template is necessary for 'typical' deployments like this one.
The deployment works correctly, regardless of whether a desired capacity is specified in the CloudFormation template or not.
-
Build number 70 was deployed (in order to start the test from a clean state - running build
ABC
) -
Build number 71 was deployed (which updates to build
XYZ
) -
The CFN stacks
playground-CODE-basic-asg-rolling-update
andplayground-CODE-no-desired-asg-rolling-update
started updating.First:
Rolling update initiated. Terminating 5 obsolete instance(s) in batches of 5, while keeping at least 5 instance(s) in service.
Then the ASG capacity is updated:
Temporarily setting autoscaling group MinSize and DesiredCapacity to 10.
-
Five
SUCCESS
signals are received, so the rolling update terminates the old instances:playground-CODE-basic-asg-rolling-update
:Terminating instance(s) [i-05c3716abc787c0e7,i-07fa3ab24b8a2aafc,i-05a6bbbf3604d1c6d,i-0975853c6e1954e88,i-0dcdb5cb3ac8f57e8]; replacing with 0 new instance(s).
playground-CODE-no-desired-asg-rolling-update
:Terminating instance(s) [i-05295af2f22bdf44a,i-0403a4e9895af9501,i-0bc968da49c888bc0,i-0facecc42865756b3,i-0f2d675b80d750756]; replacing with 0 new instance(s).
-
Once the old instances are terminated the update completes:
playground-CODE-basic-asg-rolling-update
:Successfully terminated instance(s) [i-05c3716abc787c0e7,i-07fa3ab24b8a2aafc,i-05a6bbbf3604d1c6d,i-0975853c6e1954e88,i-0dcdb5cb3ac8f57e8] (Progress 100%).
playground-CODE-no-desired-asg-rolling-update
:Successfully terminated instance(s) [i-05295af2f22bdf44a,i-0403a4e9895af9501,i-0bc968da49c888bc0,i-0facecc42865756b3,i-0f2d675b80d750756] (Progress 100%).
CloudTrail shows that the
AWSCloudFormation
user is making aTerminateInstanceInAutoScalingGroup
API call withshouldDecrementDesiredCapacity
set totrue
for both ASGs1. -
Both stacks have the correct number of instances after the deployment (5).
Full details for both stacks can be seen in the dashboard (for basic
and no-desired
).
Footnotes
-
There is also an explicit
SetDesiredCapacity
API call in both cases, which seems unnecessary. ↩