MemberMay 3, 2021 at 9:17 pm
In this article, I don’t understand why a Lambda is needed, see the section ‘Configure the Lambda function for the automatic scaling group update’. Can’t we set this up under the ‘Configure CodeDeploy for the deployment’?
MemberMay 7, 2021 at 9:21 pm
Thank you for your feedback.
This article is from AWS Prescriptive Guidance which is a centralized location for guides, and design patterns from Amazon Web Services (AWS) and AWS Partner Network (APN) Partners to help accelerate cloud adoptions. Articles from different from the usual AWS documentation in the sense that these are mostly proof of concepts or situational scenarios for using AWS services in particular applicational scenarios.
> For this particular article, it is combining Canary deployment with a blue/green deployment on CodeDepoy.
If you use CodeDeploy and deploy with a blue/green, the default behavior is that you will have another auto-scaling group with the newer version. The same number of instances as the old version will be created on the new version ASG – thus blue/green deployments. However, blue/green deployment has a drawback too. The full percentage of the traffic will be forced to the new version once they come online. Therefore, if you missed any bug on this new version all traffic will be affected by it. Of course, you can easily roll back to the old version in a blue/green environment but the full traffic was already affected and the damage has been done.
On the other hand, canary deployment will use 1 instance that will have the new version and only a small percentage of traffic will be sent to it. So can monitor for the logs on this canary instance before you can deploy to all instances. However, if you deployed your application to all instances, the drawback for a canary deployment is a longer rollback time compared to blue/green deployment.
That is why this article combines blue/green deployment with a canary deployment. The new version has an Autoscaling group which is created for the blue/green deployment. However, this new auto-scaling group will only launch 1 instance at a time to gradually switch the traffic just like a canary deployment. On AWS CodeDeploy, you can only choose one deployment method, Blue/Green or Canary.
Therefore, to control the scaling of your new ASG just like a canary release, you have to use a Lambda function to manage the number of instances. This Lambda function will control the size of the new ASG while you monitor your application like a canary release until you deploy it on all instances without any issues. And since this is a blue/green deployment, you still have the old instances in case you need a quick rollback.
Hope this helps.
Let us know if you need further assistance. The Tutorials Dojo team is dedicated to helping you pass your AWS exam!
Kenneth Samonte @ Tutorials Dojo
Log in to reply.