Exam Objective
The topic “Blue Green Deployment using Auto Scaling Launch Configurations” 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. 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
- Ease of deployment – 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.
- Risk reduction – 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.
- Easy to rollback – 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.
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.
Implementing Blue Green Deployment with New Launch Configurations
Now let’s have a closer look at how we can achieve Blue Green deployments with a change in Launch configurations.
Step 1) Log into your AWS Console. Go to the EC2 section.
Step 2) Create a new launch configuration. Let’s say a launch configuration is created with the Instance Type of t2.micro.
Step 3) 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.
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.
If you were to the Instances section, you would see 2 instances InService.
Step 4) Now let’s say you want to deploy the newer version of this application, but using a new Instance Type, let’s say t2.small. Create a new Launch configuration. You can name this launch configuration as “newlaunch”
Note:- Remember that you cannot change a launch configuration once it is created
Step 5) Now let’s attach this new launch configuration to the Autoscaling Group.
Note:- Remember that the Autoscaling Group can only be associated with one launch configuration at a time.
Go to the details of the Autoscaling Group and click on the Edit button
Step 6) Change the Launch configuration to the newly created Launch configuration and then click on the Save button
Step 7) Now increase the Max and Desired size of the Autoscaling Group to 4 by editing the Autoscaling Group. Then click on Save.
Step 8) 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.
This means that the ELB which is attached to the Autoscaling Group would now start registering the new instances
If you were to go to the ELB dashboard and check the ELB, you would see all four instances.
Step 9) 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.
Or you can perform the following steps to change the size of the Autoscaling Group.
Go ahead and change the Max and Desired values of the Autoscaling group back to 2.
You would then start seeing that the Instances of the “Initial” 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.
If you ever need to rollback, then you can do the vice versa of the above step1
1) Since you still have the older launch configuration, you can attach the Autoscaling Group to that launch configuration.
2) Change the Desired and Max values to 4 of the Autoscaling Group
3) Once the instances of the older launch configuration have been launched, change the Desired and Max values to 2 of the Autoscaling Group
Final Points to Remember
1) The Blue environment is the production environment which is currently serving traffic to the end users
2) The Green environment is a parallel and duplicate environment which has the new release of the application
3) The Blue Green deployment has the following advantages
- Ease of deployment
- Risk reduction
- Easy to rollback
4) Remember that you cannot change a launch configuration once it is created
5) Remember that the Autoscaling Group can only be associated with one launch configuration at a time
Whizlabs AWS Certified DevOps Professional Practice Tests help students to get mentally prepared for the actual certification exam. Practicing several times through AWS mock tests before the certification exam, makes you better prepared for the real one.
- Top 20 Questions To Prepare For Certified Kubernetes Administrator Exam - August 16, 2024
- 10 AWS Services to Master for the AWS Developer Associate Exam - August 14, 2024
- Exam Tips for AWS Machine Learning Specialty Certification - August 7, 2024
- Best 15+ AWS Developer Associate hands-on labs in 2024 - July 24, 2024
- Containers vs Virtual Machines: Differences You Should Know - June 24, 2024
- Databricks Launched World’s Most Capable Large Language Model (LLM) - April 26, 2024
- What are the storage options available in Microsoft Azure? - March 14, 2024
- User’s Guide to Getting Started with Google Kubernetes Engine - March 1, 2024
Nice.