Rolling update on AWS Autoscaling
AWS autoscaling groups let you manage a set of instances and scale them in or out, based on various parameters.
Deployment strategy: To launch new instances with latest code version and deprecate old ones once newer are working.
Deployment to AWS Autoscaling group is seamless if we're using code deploy.
I've few problems with Code Deploy.
- We need to write code deploy specific appspec, etc. in our codebase.
- Code deploy needs an agent pre-installed in the VMs.
- It doesn't work with multi cloud. Yes, their on-premises documentation claims it works. However, it's terrible in practice.
Alternatively, launch with pre-baked AMI --> download latest zip or artifact --> start the process.
Unfortunately, Autoscaling groups don't have an option to do "Replace all my instances". We need the dirty workaround,
- Setup a termination policy: "Oldest First"
- Increase capacity and wait for new instances to come up.
- Decrease capacity after your newer instances are healthy.
- Create a copy of existing autoscaling group to new one, deploy latest code there.
- Delete previous autoscaling group.
Both strategies come at their own price, however, the workaround needs to be managed by deployment tool.
P.S.: Google Compute Platform gives the option of rolling replacement out of the box, in their instance groups.