I am trying to automate Autoscaling system in AWS. Normal deployment for us is just checking code into Gitlab and creating a new Tag, then Gitlab CI\CD runs automatically and pushes the code up to artifactory. we have 3 instances. we autosclaue up to 6 and then reduces it to 3.But then we just need to scale out our auto scaling group in AWS, and it builds 3 new servers that pull the new code down, and then scale the ASG back out, killing the 3 old servers. I want to automate this process. Can anyone help me if we can achieve this after deployment
0
votes
Doesn't this just happen automatically when you update the launch profile?
- jordanm
If you are wanting to do a real blue-green deployment, you need two ASGs
- jordanm
Thanks for the prompt reply. we already have policy to scale up and down instances if any issues like cpu etc happens. I want to automate the process during deployment to release latest version on the instances. we currently have 3 instances we austoscale to 6 and then reduce to 3. Is there a way we can achieve this? thanks
- Gaurav Vats
1 Answers
0
votes
There is a new feature called "Instance Refresh" that will probably do what you want. You just need to call the StartInstanceRefresh API and give the MinHealthy% (which determines the batch size) and the warmup time (which determines the time between batches).
If will terminate and launch the instances in a batch at about the same time, so unless you're ok with a bit of downtime, probably leave the MinHealthy% at the default of 90% so that it only does 1 instance per batch
https://docs.aws.amazon.com/cli/latest/reference/autoscaling/start-instance-refresh.html