MontyCloud Blog

Mitigate downtime risks with simplified blue/green deployments of Amazon ECS and AWS Fargate Applications

Written by Bhrikuty Aggarwal | May 6, 2021 4:35:00 PM

Amazon ECS and AWS Fargate help customers modernize their applications and scale efficiently. DevOps teams rely on Blue/Green deployments to continuously release features without compromising reliability or customer experience. In this blog, Bhrikuty Aggarwal, Sr. Cloud Engineer at MontyCloud writes about how you can save up to 80% in time and effort setting up and managing your application deployment and CloudOps with MontyCloud DAY2.

 – Sabrinath Rao

Software development teams balance frequent functional updates with customer experience and code quality. One of the most common best practices in Continuous Integration and Continuous Deployment (CI/CD) paradigm is Blue/Green deployments. In this blog I introduce a new well-architected blueprint that reduces the complexity of implementing blue/green and canary deployments for Amazon Elastic Container Service (ECS) and AWS Fargate applications.

 
Traditional waterfall deployment methods do not work for modern applications.

It is customary to have a single production environment for traditional 3-tier applications. Even if multiple instances of an application are running on a server cluster, they run the same version. Any update involves updating all instances of the application at the same time. IT Teams perform a backup or a planned failover, take the application down, copy the new binaries, execute their test suites and restart the application. Inevitably there is a period of poor customer experience or even downtime. This process is cumbersome, expensive and incompatible with modern cloud paradigms where DevOps teams release multiple features everyday.

 
What are Blue/Green deployments?

Blue/Green deployment is a cloud infrastructure management technique for releasing an application by shifting the traffic between two identical environments running different versions of the same application. Blue/Green deployment is recommended for critical workloads since it mitigates the risks associated with deploying software, such as downtime.

DevOps teams want to expose a small percentage of their customers to the new release to gather feedback about a feature before it is released to the broader population. This is often referred to as canary analysis or canary testing.

With the DAY2

 

 

 

 Amazon ECS and AWS Fargate Blue/Green Deployment Blueprint, DevOps teams can minimize interruptions caused by the changes of a new application version. With this blueprint they can easily provision and test the new application version alongside the old version before slowly routing their production traffic, in just a few clicks.

 
Setting up Blue/Green deployments are complex

Setting up a CloudOps ready Blue/Green deployment process requires specialized skills. You may need to do many iterations before you get it working right. The following outlines the 5 essential steps that you need to follow to set up a Blue/Green environment with AWS CodeDeploy and Amazon ECS.

Step 1: Create a green task set
 
 
Step 2: Reconfigure to send a subset of traffic to the green target group
 
 
Step 3: Shift 20% of production traffic to the green target group
 
 
Step 4: Shift 100% of production traffic to green target group
 
 
Step 5: Remove blue task set and shift all traffic to green task definition

(Images source: ECS blue green deployments by Clare Liguori)

 
Why should I use the DAY2 Blue/Green Deployment Blueprint?

You should use the DAY2 Blue/Green Deployment Blueprint because it can help you save up to 80% of your time and effort in setting and running your Blue/Green environments.

With this blueprint, you can enable your developers to deploy Blue/Green deployment environments with Amazon ECS and AWS Fargate including Autoscaling, Application load balancer and IAM (Identity and Access Management) Roles with appropriate grants & permissions for management on demand. Now your developers can deploy their applications faster and with zero downtime.

 
How can I get started with the DAY2 Blue/Green Deployment Blueprint?

Getting started with the Blueprint is very simple and straightforward. All you do is click on the deploy button of the ECS Fargate Blue/Green Deployment using CodeDeploy Blueprint in the DAY2 Provisioning Catalog.

We have taken care of most of the parameters for you as default, which you can update if you wish to. Next, you fill mandatory parameters like the VPC, Subnets in which you want to launch your applications, specify the ECR repository and your application image that you want to deploy.

That’s it, you are ready to deploy your application and DAY2 will take care of everything at the backend.

Once your application is deployed, you can visit the URL to view your application. To update the application, click on ‘Change Configuration’, update the image tag and redeploy the application. That’s it!

Deploying ECS Fargate Blue/Green deployment using CodeDeploy

DAY2  will automatically run the pipeline in the backend to deploy the latest version of your application and automatically shift the specified traffic to this new version which you can test. Once you are satisfied, you can switch all incoming traffic to this newer version of the application. And if something goes wrong or if you are not satisfied with the newer version, you can rollback at the click of a button and DAY2 will take care of everything in the backend again.

DAY2 also has an extended task library, that you can use with your application so that you don’t have to write your own custom scripts or perform those tasks manually each day.

Blue/Green ECS Fargate Blueprint block diagram

 
Conclusion

With DAY2 you can simplify deployments for your development teams to innovate faster, while IT teams save up to 80% in time and effort required to set up and run these environments. The DAY2 Blue/Green Deployment Blueprint for Amazon ECS and Fargate is available through DAY2 Well-Managed Applications.