{"id":37326,"date":"2017-11-30T20:12:49","date_gmt":"2017-11-30T20:12:49","guid":{"rendered":"https:\/\/www.whizlabs.com\/?p=37326"},"modified":"2024-05-17T12:49:14","modified_gmt":"2024-05-17T07:19:14","slug":"blue-green-deployment","status":"publish","type":"post","link":"https:\/\/www.whizlabs.com\/blog\/blue-green-deployment\/","title":{"rendered":"AWS: Blue Green Deployment"},"content":{"rendered":"<p id=\"docs-internal-guid-ff514326-90ee-3e7c-89f4-ae795da31b9b\" style=\"text-align: justify;\"><b>Exam Objective<\/b><\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\">The topic &#8220;Blue Green Deployment using Auto Scaling Launch Configurations&#8221; addresses the Continuous Delivery and Process Automation topic as highlighted in the <a href=\"https:\/\/d0.awsstatic.com\/training-and-certification\/docs-devops-pro\/AWS_certified_devops_engineer_professional_blueprint.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">AWS Blueprint<\/a> for the exam guide<\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\"><a href=\"https:\/\/www.whizlabs.com\/aws-devops-certification-training\/\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter wp-image-47420 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/05\/Preparing-for-Microsoft-Azure-Certification_-Get-Certified-Today-3.jpeg\" alt=\"AWS Certified DevOps Professional\" width=\"728\" height=\"90\" \/><\/a><\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\">One of the key requirements of this topic is the concept of Continuous Deployment. The Blue Green Deployment concept is an important concept. This now a widely held practice in many organizations that look towards continuous delivery.<\/p>\n<h2 style=\"text-align: justify;\">What is Blue Green Deployment?<\/h2>\n<p dir=\"ltr\" style=\"text-align: justify;\">The below diagram from AWS demonstrates the Blue Green deployment scenario.<\/p>\n<p dir=\"ltr\" style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"aligncenter wp-image-37327 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/05\/AWSDevOPS_bgdua_1.png\" alt=\"Blue Green Deployment\" width=\"458\" height=\"385\" \/><\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\">Here the Blue environment is the production environment which is currently serving traffic to the end users. The Green environment is a parallel and duplicate environment which has the new release of the application. When the new application version needs to be released, the switch is made from the Blue environment to the Green environment. The users will then be directed to the new environment and get the new application version. The advantages of such a deployment are<\/p>\n<ol style=\"text-align: justify;\">\n<li>Ease of deployment \u2013 Here the deployment of the new version is just a simple switch which can happen at the DNS level. This reduces the amount of downtime which would be rendered to the users when the application moves to the new version.<\/li>\n<li>Risk reduction \u2013 Ideally before deployment the Green environment, a thorough check would be made to ensure that the environment was functionally working as per the requirements. This would make the release less prone to risk when the actual cutover is completed.<\/li>\n<li>Easy to rollback \u2013 After the switch is made from the Blue environment to the Green environment, the Blue environment can be kept running until it is ensured that the Green environment is working as it should. This is so that if there are any issues with the newly deployed environment, it becomes easier to shift back to the older environment.<\/li>\n<\/ol>\n<p dir=\"ltr\" style=\"text-align: justify;\">There are many ways to carry out Blue Green Deployment. This topic focuses on how it can be accomplished by modifying the launch configurations of the Autoscaling Group.<\/p>\n<h4 style=\"text-align: justify;\"><b>Implementing Blue Green Deployment with New Launch Configurations<\/b><\/h4>\n<p dir=\"ltr\" style=\"text-align: justify;\">Now let\u2019s have a closer look at how we can achieve Blue Green deployments with a change in Launch configurations.<\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\"><strong>Step 1)<\/strong> Log into your AWS Console. Go to the EC2 section.<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"wp-image-37333 size-full aligncenter\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/05\/AWSDevOPS_bgdua_2.png\" alt=\"Auto Scaling Groups\" width=\"171\" height=\"187\" \/><\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\"><strong>Step 2)<\/strong> Create a new launch configuration. Let\u2019s say a launch configuration is created with the Instance Type of t2.micro.<\/p>\n<p dir=\"ltr\" style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"aligncenter wp-image-37334 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/05\/AWSDevOPS_bgdua_3.png\" alt=\"Creating New Launch Configuration\" width=\"528\" height=\"238\" \/><\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\"><strong>Step 3)<\/strong> Next, create an Autoscaling Group from the launch configuration. For the purpose of this demo, we can keep the initial number of instances to 2.<\/p>\n<p dir=\"ltr\" style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"aligncenter wp-image-37335 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/05\/AWSDevOPS_bgdua_4.png\" alt=\"Autoscaling Group\" width=\"1025\" height=\"453\" \/><\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\">So, in the above example, we have an Autoscaling group which has a Desired, Min and Max value of 2. You can also attach the Autoscaling Group to a load balancer if required.<\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\">If you were to the Instances section, you would see 2 instances InService.<\/p>\n<p dir=\"ltr\" style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"aligncenter wp-image-37336 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/05\/AWSDevOPS_bgdua_5.png\" alt=\"Blue green deployment\" width=\"1134\" height=\"304\" \/><\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\"><strong>Step 4)<\/strong> Now let\u2019s say you want to deploy the newer version of this application, but using a new Instance Type, let\u2019s say t2.small. Create a new Launch configuration. You can name this launch configuration as \u201cnewlaunch\u201d<\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\"><em><b>Note:- Remember that you cannot change a launch configuration once it is created<\/b><\/em><\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"aligncenter wp-image-37337 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/05\/AWSDevOPS_bgdua_6.png\" alt=\"Launch Configuration\" width=\"1145\" height=\"469\" \/><\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\"><strong>Step 5)<\/strong> Now let\u2019s attach this new launch configuration to the Autoscaling Group.<\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\"><em><b>Note:- Remember that the Autoscaling Group can only be associated with one launch configuration at a time.<\/b><\/em><\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\">Go to the details of the Autoscaling Group and click on the Edit button<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"aligncenter wp-image-37338 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/05\/AWSDevOPS_bgdua_7.png\" alt=\"Autoscaling Group\" width=\"1116\" height=\"260\" \/><\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\"><strong>Step 6)<\/strong> Change the Launch configuration to the newly created Launch configuration and then click on the Save button<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"aligncenter wp-image-37339 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/05\/AWSDevOPS_bgdua_8.png\" alt=\"Launch Configuration\" width=\"1092\" height=\"290\" \/><\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\"><strong>Step 7)<\/strong> Now increase the Max and Desired size of the Autoscaling Group to 4 by editing the Autoscaling Group. Then click on Save.<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"aligncenter wp-image-37340 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/05\/AWSDevOPS_bgdua_9.png\" alt=\"Autoscaling Group Editing\" width=\"530\" height=\"234\" \/><\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\"><strong>Step 8)<\/strong> Now if you were to go to the Instances tab for your Autoscaling Group, you would see 2 new instances launching that are part of the new launch configuration.<\/p>\n<p dir=\"ltr\" style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"aligncenter wp-image-37330 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/05\/AWSDevOPS_bgdua_10.png\" alt=\"AWS Certification\" width=\"1143\" height=\"340\" \/><\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\">This means that the ELB which is attached to the Autoscaling Group would now start registering the new instances<\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\">If you were to go to the ELB dashboard and check the ELB, you would see all four instances.<\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\"><strong>Step 9)<\/strong> Now to remove the older instances, you could either mark the older services in the Standby state by using the CLI so that requests are not routed to these instances. Or you can even terminate the instances if required.<\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\">Or you can perform the following steps to change the size of the Autoscaling Group.<\/p>\n<p dir=\"ltr\" style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"aligncenter wp-image-37331 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/05\/AWSDevOPS_bgdua_11.png\" alt=\"Azure Certification\" width=\"563\" height=\"376\" \/><\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\">Go ahead and change the Max and Desired values of the Autoscaling group back to 2.<\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\">You would then start seeing that the Instances of the \u201cInitial\u201d Launch configuration start getting terminated. This is because the default termination policy of the Autoscaling Group during a scale in the process is to remove the instances which have the older launch configuration.<\/p>\n<p style=\"padding-left: 60px; text-align: justify;\"><img decoding=\"async\" class=\"aligncenter wp-image-37332 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/05\/AWSDevOPS_bgdua_12.png\" alt=\"Cloud Computing\" width=\"1111\" height=\"460\" \/><\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\">If you ever need to rollback, then you can do the vice versa of the above step1<\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\">1) Since you still have the older launch configuration, you can attach the Autoscaling Group to that launch configuration.<\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\">2) Change the Desired and Max values to 4 of the Autoscaling Group<\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\">3) Once the instances of the older launch configuration have been launched, change the Desired and Max values to 2 of the Autoscaling Group<\/p>\n<h4 style=\"text-align: justify;\"><b>Final Points to Remember\u00a0<\/b><\/h4>\n<p dir=\"ltr\" style=\"text-align: justify;\">1) The Blue environment is the production environment which is currently serving traffic to the end users<\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\">2) The Green environment is a parallel and duplicate environment which has the new release of the application<\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\">3) The Blue Green deployment has the following advantages<\/p>\n<ul style=\"text-align: justify;\">\n<li>Ease of deployment<\/li>\n<li>Risk reduction<\/li>\n<li>Easy to rollback<\/li>\n<\/ul>\n<p dir=\"ltr\" style=\"text-align: justify;\">4) Remember that you cannot change a launch configuration once it is created<\/p>\n<p dir=\"ltr\" style=\"text-align: justify;\">5) Remember that the Autoscaling Group can only be associated with one launch configuration at a time<\/p>\n<p class=\"p1\" style=\"text-align: justify;\">Whizlabs\u00a0<a href=\"https:\/\/www.whizlabs.com\/aws-devops-certification-training\/\"><span class=\"s1\">AWS Certified DevOps Professional<\/span><\/a>\u00a0Practice Tests help students to get mentally prepared for the actual certification exam. Practicing several times through AWS\u00a0mock tests before the certification exam, makes you better prepared for the real one.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Exam Objective The topic &#8220;Blue Green Deployment using Auto Scaling Launch Configurations&#8221; addresses the Continuous Delivery and Process Automation topic as highlighted in the AWS Blueprint for the exam guide One of the key requirements of this topic is the concept of Continuous Deployment. The Blue Green Deployment concept is an important concept. This now a widely held practice in many organizations that look towards continuous delivery. What is Blue Green Deployment? The below diagram from AWS demonstrates the Blue Green deployment scenario. Here the Blue environment is the production environment which is currently serving traffic to the end users. [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":47422,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[4],"tags":[180,184,201,494,604,608],"class_list":["post-37326","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aws-certifications","tag-auto-scaling-launch-configurations","tag-aws","tag-aws-certifications","tag-blue-green-deployment-scenario","tag-cloud-computing","tag-cloud-computing-certifications"],"uagb_featured_image_src":{"full":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/122.jpg",725,282,false],"thumbnail":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/122-150x150.jpg",150,150,true],"medium":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/122-300x117.jpg",300,117,true],"medium_large":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/122.jpg",725,282,false],"large":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/122.jpg",725,282,false],"1536x1536":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/122.jpg",725,282,false],"2048x2048":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/122.jpg",725,282,false],"profile_24":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/122.jpg",24,9,false],"profile_48":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/122.jpg",48,19,false],"profile_96":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/122.jpg",96,37,false],"profile_150":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/122.jpg",150,58,false],"profile_300":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/122.jpg",300,117,false],"tptn_thumbnail":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/122-250x250.jpg",250,250,true],"web-stories-poster-portrait":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/122.jpg",640,249,false],"web-stories-publisher-logo":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/122.jpg",96,37,false],"web-stories-thumbnail":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2017\/09\/122.jpg",150,58,false]},"uagb_author_info":{"display_name":"Pavan Gumaste","author_link":"https:\/\/www.whizlabs.com\/blog\/author\/pavan\/"},"uagb_comment_info":1,"uagb_excerpt":"Exam Objective The topic &#8220;Blue Green Deployment using Auto Scaling Launch Configurations&#8221; addresses the Continuous Delivery and Process Automation topic as highlighted in the AWS Blueprint for the exam guide One of the key requirements of this topic is the concept of Continuous Deployment. The Blue Green Deployment concept is an important concept. This now&hellip;","_links":{"self":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts\/37326","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/comments?post=37326"}],"version-history":[{"count":5,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts\/37326\/revisions"}],"predecessor-version":[{"id":95984,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts\/37326\/revisions\/95984"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/media\/47422"}],"wp:attachment":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/media?parent=37326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/categories?post=37326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/tags?post=37326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}