0
votes

I need help in order to achieve Blue-Green Deployment.

What I have in My Bucket -

  1. One Blue Environment hosted on ElasticBeanStalk.
  2. One Green Environment hosted on ElasticBeanStalk.
  3. Both Environments are getting created by CF-Template.Both are having their own ELB.

What I am looking for -

  1. I need to switch traffic from Blue to green.
  2. First I need to know which Environment is currently live so that I can plan my app deployment to next Environment.
  3. Once I knew my current Environment(Blue in this case) , I deployed my app to Green-Environment and now this Environment is ready to accept the traffic.
  4. I need to migrate 25% traffic to Green and do a health check, If health check is okay I will add another 25% and do a health check and so-on.
  5. At any point if health check fails , I should be able to route entire traffic back to Blue Environment.

I need to implement this solution in my CI-CD Job. My CI job is creating my package and deploying this to S3. My CD job is provision the Infrastructure (ElasticBeanStalk) and uploading the package to newly created Environment.

1

1 Answers

0
votes

You can't control deployment on AWS Elastic Beanstalk like that, since it involves having two live environments and doing a cname swap. Not exactly what your'e trying to achieve but something close it is called Immudatable Deployments which are available out of the box.

From the documentaion:

To perform an immutable environment update, Elastic Beanstalk creates a second, temporary Auto Scaling group behind your environment's load balancer to contain the new instances. First, Elastic Beanstalk launches a single instance with the new configuration in the new group. This instance serves traffic alongside all of the instances in the original Auto Scaling group that are running the previous configuration.

When the first instance passes health checks, Elastic Beanstalk launches additional instances with the new configuration, matching the number of instances running in the original Auto Scaling group. When all of the new instances pass health checks, Elastic Beanstalk transfers them to the original Auto Scaling group, and terminates the temporary Auto Scaling group and old instances.