awslabs / codedeploy-blue-green

These artifacts are associated with the blog post on Blue/Green Deployments with CodeDeploy.
Apache License 2.0
48 stars 50 forks source link

Updating Stack #2

Open mmdonaldson opened 6 years ago

mmdonaldson commented 6 years ago

in cleanup.sh you remove the old auto scaling group.

If in future you try to update this stack in cloudformation, won't it fail because the initial auto scaling group no longer exists?

clintoncampbell commented 6 years ago

Been wrestling with this same issue and haven't found any guidance after quite a bit of research. My impression is that the ASG and deployment group need to be created outside of CloudFormation unless you take the approach of manually specifying the targets for each deployment.

mmdonaldson commented 6 years ago

Yes ended up getting advice from AWS Solution Architect and he suggested your solution. Just a pain because any update to the ASG means manual updates so you have to throw Infrastructure as code out the window @clintoncampbell

nidhi7 commented 5 years ago

Hi, I was trying to solve the same problem and have some thoughts. Also, if you were able to find a solution, please let us know. (Although it might just be better to wait for Cloudformation to support blue/green with codedeploy).

According to https://aws.amazon.com/blogs/devops/performing-bluegreen-deployments-with-aws-codedeploy-and-auto-scaling-groups/ there are 2 ways of doing blue green deployments. Following the second way mentioned there, I was thinking of doing the following in cloudformation: (not sure if this is feasible, any thoughts would be helpful)

  1. Have 2 ASGs before hand. One being used in prod with instances and the other one without instances.
  2. On every deployment, have a script which would query the 2 ASGs to check instance count. The one with count>0 is prod ASG.
  3. Add the same Prod ASG type and count of instances to the ASG which does not have any instances
  4. Specify the ASG with new instances to Codedeploy and codedepoy uses this for deploying new code and turns it into prod ASG.
  5. Delete the older instances from the older prod ASG.