{"id":4130,"date":"2022-04-22T08:42:50","date_gmt":"2022-04-22T08:42:50","guid":{"rendered":"https:\/\/petabytz.com\/?p=4130"},"modified":"2026-02-19T11:12:11","modified_gmt":"2026-02-19T11:12:11","slug":"blue-green-deployment-on-aws-for-high-availability-of-web-aplication","status":"publish","type":"post","link":"https:\/\/petabytz.com\/blogs\/blue-green-deployment-on-aws-for-high-availability-of-web-aplication\/","title":{"rendered":"Blue-Green Deployment on AWS for High availability of Web Aplication"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"4130\" class=\"elementor elementor-4130\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-a767c77 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a767c77\" data-element_type=\"section\" data-e-type=\"section\" data-settings=\"{&quot;ekit_has_onepagescroll_dot&quot;:&quot;yes&quot;}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-9eaf952\" data-id=\"9eaf952\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-bfe5455 elementor-widget elementor-widget-heading\" data-id=\"bfe5455\" data-element_type=\"widget\" data-e-type=\"widget\" data-settings=\"{&quot;ekit_we_effect_on&quot;:&quot;none&quot;}\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h1 class=\"elementor-heading-title elementor-size-default\">Blue-Green Deployment on AWS for High availability of Web Aplication<\/h1>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-62f5cc7 elementor-widget elementor-widget-text-editor\" data-id=\"62f5cc7\" data-element_type=\"widget\" data-e-type=\"widget\" data-settings=\"{&quot;ekit_we_effect_on&quot;:&quot;none&quot;}\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<figure><figcaption data-selectable-paragraph=\"\"><p>When an application is developed and deployed having two separate, but identical, environments \u2014 blue and green \u2014 this deployment method increases availability and reduces risk.<\/p><p><strong>Blue and Green architecture<\/strong><\/p><\/figcaption><\/figure><p data-selectable-paragraph=\"\">Blue\/green deployment on the AWS platform provides a safer, less stressful way to upgrade production software. Let\u2019s think of a v1 production environment \u201cblue.\u201d Now, set up a second environment labeled \u201cgreen\u201d 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.<\/p><p data-selectable-paragraph=\"\">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.<\/p><section><h2 data-selectable-paragraph=\"\">Benefits of Blue\/Green Deployment<\/h2><ol><li data-selectable-paragraph=\"\">If the validation tests of the green environment fail before you start sending real traffic, then we can dispose of the environment without ever having affected the live blue production environment.<\/li><li data-selectable-paragraph=\"\">If we start switching a small proportion of traffic from blue to green and encounter serious issues, then we can quickly switch back to blue and restore service within minutes. This process is sometimes called\u00a0<em>canary analysis:<\/em>\u00a0you test that the new deployment works in a real-world scenario with a small set of your users.<\/li><li data-selectable-paragraph=\"\">We can easily take advantage of newer, more powerful, or cheaper servers by simply launching the newer server types in your green environment, validating them, and then cutting over.<\/li><li data-selectable-paragraph=\"\">We can also take advantage of\u00a0<a href=\"http:\/\/aws.amazon.com\/autoscaling\/\" target=\"_blank\" rel=\"noopener noreferrer\">Auto Scaling<\/a>\u00a0to optimize costs. You can allow the size of the fleet of servers in your green environment to grow gradually as you shift more traffic to it, while the size of the blue fleet will shrink as it handles less traffic.<\/li><\/ol><h2 data-selectable-paragraph=\"\">AWS has tools and services to make zero downtime deployments :-<\/h2><p data-selectable-paragraph=\"\">AWS Elastic Beanstalk, a platform as a service (PaaS) that supports most popular development platforms and languages. If your application doesn\u2019t require a very customized platform environment to operate, this is a great, easy to use service. It also offers zero downtime deployments.<\/p><p data-selectable-paragraph=\"\">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.<\/p><h2>Blue\/Green Deployments with Elastic Beanstalk<\/h2><p data-selectable-paragraph=\"\">Step 1<\/p><p data-selectable-paragraph=\"\">Deploy an environment ,for now name it Blue.<\/p><p>When the environment is up and running check it by hitting the URL provided :-<\/p><p>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.<\/p><p>Now check the if this environment is up and running.<\/p><p>From the new environment\u2019s dashboard, choose\u00a0<strong>Actions<\/strong>, and then choose\u00a0<strong>Swap Environment URLs<\/strong>.<\/p><p>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.<\/p><p data-selectable-paragraph=\"\">here the URL is of the Blue environment but after swapping it is directing this URL to Green Environment.<\/p><h2 data-selectable-paragraph=\"\">Conclusion<\/h2><p data-selectable-paragraph=\"\">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.<\/p><\/section>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Blue-Green Deployment on AWS for High availability of Web Aplication When an application is developed and deployed having two separate, but identical, environments \u2014 blue and green \u2014 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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[27,25],"tags":[],"class_list":["post-4130","post","type-post","status-publish","format-standard","hentry","category-aws","category-blogs"],"acf":[],"_links":{"self":[{"href":"https:\/\/petabytz.com\/blogs\/wp-json\/wp\/v2\/posts\/4130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/petabytz.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/petabytz.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/petabytz.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/petabytz.com\/blogs\/wp-json\/wp\/v2\/comments?post=4130"}],"version-history":[{"count":3,"href":"https:\/\/petabytz.com\/blogs\/wp-json\/wp\/v2\/posts\/4130\/revisions"}],"predecessor-version":[{"id":14753,"href":"https:\/\/petabytz.com\/blogs\/wp-json\/wp\/v2\/posts\/4130\/revisions\/14753"}],"wp:attachment":[{"href":"https:\/\/petabytz.com\/blogs\/wp-json\/wp\/v2\/media?parent=4130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/petabytz.com\/blogs\/wp-json\/wp\/v2\/categories?post=4130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/petabytz.com\/blogs\/wp-json\/wp\/v2\/tags?post=4130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}