Welcome to the final stage of the CI workflow - the Continuous Deployment.
We are now ready to take the AMI we produced during the Continuous Delivery step and deploy that to production.
For this process, we are going to use blue/green deployment approach. Our production environment is going to consist of ELB and two Auto scaling Groups (blue and green):
If we assume that the blue group holds our current production nodes, then upon deployment, we do the following:
Attach ELB to the green group
Scale the green group up using the new AMI
Check for errors
Scale the blue group down, effectively shifting traffic to the instances of the new AMI
As we are building on top of our existing CI pipelines, there are only a few changes we need to make to the code from the previous chapter. We need to add a few extra Terraform resources; let us take a look at those.