Use case

Blue-Green deployment strategy
for zero downtime

1. Overview

SecurifyNet offers API solutions to insurance companies to manage their financial transactions. Their platform covers functionalities like premium payments, claims processing, policy management, and other financial transactions.
Pain
SecurifyNet used Rolling Updates to deploy new version in their app. This caused interruptions in ongoing transaction sessions as the new version was deployed without any health checks.

2. Goal

Attain zero downtime while deploying new versions.

Solution:
To ensure that SecurifyNet successfully implements all the new updates without causing disruptions in the sessions, they should use Blue-Green Deployment instead of their existing Rolling Updates strategy.

What is Blue-Green Deployment?

Initially, the blue environment is where the live version of the application runs.

The green environment mirrors the blue environment’s configuration but does not serve live traffic.

The new version is added to the green environment and is subjected to a series of smoke tests to ensure everything is working as expected.

After verifying that the application in the green environment is stable and operates correctly, the traffic is switched from the blue environment to the green environment.

This switch can be achieved through various methods, such as:
(1) DNS records update
(2) Load balancer configuration change
(3) Router or gateway redirection

Why to choose Blue-Green Deployment over Rolling Updates?

For applications where user sessions must not be disrupted, rolling updates might pose a risk. Blue-green deployments, on the other hand, ensure that all new sessions are directed to the green environment while existing sessions complete in the blue environment, ensuring the continuity of user sessions.

3. IAMOPS Solution- High Level Design

Based on the requirements, this is how IAMOPS performed Blue-Green deployment strategy for SecurifyNet.

Blue-Green Setup

  • Build and tag the Docker image for the new version using AWS ECS Service and AWS CodeDeploy.
  • Deploy the new version to the Green environment.
  • Configure AWS Elastic Load Balancer to route a portion of traffic to the Green environment ECS task.

Green Environment Testing

  • Implement automated testing in the Green environment with Jenkins.
  • Validate the Green environment thoroughly. For this, we utilized AWS CloudWatch.
  • Monitor the Green environment's task performance.

Traffic Redirection

  • AWS Elastic Load Balancer gradually increases traffic to the Green environment task.
  • With AWS CloudWatch, we verify application stability in the Green environment task.

Blue Environment Decommission

  • If the Green environment task is stable, decommission the Blue environment task.
  • If issues arise, rollback to the Blue environment task.

Other technologies configured:

  1. AWS CloudFront- for protecting the backend content
  2. Amazon RDS- for data consistency
  3. AWS Fargate- for efficient resource allocation

Process of Blue-Green deployments

4. Best Practices Implemented

Security:

With features such as SSL termination, encryption, and protection against common web exploits, AWS Elastic Load Balancer contributed to enhancing the security during the deployment process.

Operational Excellence:

Dynamic resource allocation with AWS Fargate and AWS ECS during Blue-Green deployments ensured a smooth and cost-effective transition between environments.

Reliability:

By monitoring key metrics such as latency, error rates, and traffic patterns with AWS CloudWatch enabled proactive identification and resolution of issues.

Performance Efficiency:

Configuring AWS CloudFront with caching policies and distribution settings ensured optimal performance and responsiveness for end-users throughout the deployment process.

Cost Optimization:

Utilizing Amazon RDS to select right-sized instances for both Blue and Green environments, and taking into account the actual workload requirements allowed for a more cost-effective utilization of database resources during the deployment process.

Sustainability:

By automating deployment processes, AWS CodeDeploy reduced the time and resources required for deployment tasks, contributing to overall sustainability by minimizing human involvement and reducing operational overhead.

5. Summary

By successfully implementing Blue-Green deployments on ECS, SecurifyNet was able to achieve near zero downtime and rollback capabilities.

Furthermore, Continuous Delivery/Deployment practices speed up the process of releasing versions by shortening feedback loops and automating repetitive tasks. This ensured that the risks of introducing flaws during new version updates were reduced for SecurifyNet.

Appendix

Rolling Updates

Rolling update involves one live production environment where the application is serving the traffic and a staging environment which acts as a duplicate of the production environment. Before applying updates to the production environment, the changes are first deployed to the staging environment for comprehensive testing of the new version

Once the updates in the staging environment are validated, a rolling update is initiated. Instead of updating all instances of the application simultaneously, the update is applied gradually, one subset or group of instances at a time.

While one subset of instances is being updated, the remaining instances continue to handle user requests. If problems are detected at any point, the update can be paused, and the deployment can be rolled back to the previous version. The rolling update continues until all instances have been updated.

Blue-Green Deployment

The blue-green deployment creates two separate production environments, “blue” and “green”. The blue production environment serves live traffic while the green environment is a clone of the live production environment. This environment is not accessible to the end users.
Any new updates are deployed to the staging environment for necessary testing and error fixing. Once all the tests are successful, it is then deployed to the green production environment for further tests and validations.
Upon ensuring that the new green environment is working fine, the traffic is redirected to this environment, while the blue production environment is discarded or can be kept as a backup for future changes.

Let's get the Conversation started!

Click below to explore the DevOps journey with us.

Looking for DevOps to join my team

Looking for a job opportunity

Apply to

Blue-Green deployment strategy for zero downtime

Thanks for applying!

Your application has been sent to our recruitment team successfully. If your profile is selected, our recruitment team will get in touch with you.

We wish you all the best!