When an application is developed and deployed having two separate, but identical, environments — blue and green — this deployment method increases availability and reduces risk.
Blue and Green architecture
Blue/green deployment on the AWS platform provides a safer, less stressful way to upgrade production software. Let’s think of a v1 production environment “blue.” Now, set up a second environment labeled “green” that is running v2 of our software. Once we validate the green environment, we can quickly switch traffic from the blue to the green environment. At this point, we can choose to retain or dispose of the blue environment.
Once we bring the green environment up, we can validate the new software before going live. Then, we start shifting traffic away from the blue environment and send it to the green one. Normally, we do that using weighted DNS resolution because it gives us an easy way to push more traffic to the green environment or revert traffic back to the blue environment in case of issues.
AWS Elastic Beanstalk, a platform as a service (PaaS) that supports most popular development platforms and languages. If your application doesn’t require a very customized platform environment to operate, this is a great, easy to use service. It also offers zero downtime deployments.
If your application has a more complex multi-tier architecture, AWS OpsWorks allows you to model complex decoupled applications. It trades in some of the ease of use of Elastic Beanstalk for increased flexibility. A great feature that makes blue/green deployment easy is the ability to clone a stack and create a copy of your blue stack as a baseline for your green one.
Step 1
Deploy an environment ,for now name it Blue.
When the environment is up and running check it by hitting the URL provided :-
Clone your current environment, or launch a new environment running the configuration you want.For now we will create an environment named greenevn as Web Server and Tomcat platform.
Now check the if this environment is up and running.
From the new environment’s dashboard, choose Actions, and then choose Swap Environment URLs.
After Elastic Beanstalk completes the swap operation, let us verify that the new environment responds when you try to connect to the old environment URL.
here the URL is of the Blue environment but after swapping it is directing this URL to Green Environment.
Blue-Green Deployment (sometimes also called A-B Deployment of Red-Black Deployment) creates two identical environment in which the Blue one is live and Green is idle ,all the development and testing occurs on Green environment and when Green is ready to deploy we route all the traffic to Green one (In testing stage we can route small percentage of traffic to Green for testing purpose). Thus it results in an environment which have very less down time.