Concepts

In a blue/green deployment, you have two identical environments: one Blue (the current production environment) and one Green (the new version of your application ready to be deployed). Once the Green environment is ready and tested, you can switch traffic over from Blue to Green, minimizing downtime and risk. If something goes wrong, you can easily switch back to the Blue environment.

AWS Services for Blue/Green Deployments:

  • AWS Elastic Beanstalk: Provides an easy way to perform blue/green deployments using cloned environments and swapping CNAMEs or load balancers.
  • Amazon Route 53: Allows you to redirect user traffic to different environments using DNS.
  • AWS CodeDeploy: Supports blue/green deployments by provisioning a new set of instances and re-routing load balancer traffic.

Rolling Deployments

Rolling deployments update instances in a sequential manner rather than all at once. This allows you to slowly roll out the change and monitor its effect. During the rolling update, a subset of servers is taken out of service, updated, and then put back into service.

AWS Services for Rolling Deployments:

  • AWS Elastic Beanstalk: Supports rolling updates, enabling you to specify the batch size and the pause time between batches.
  • Amazon EC2 Auto Scaling: Allows rolling updates of EC2 instances in an Auto Scaling group by adjusting desired capacity and controlling the launch configuration.

Canary Deployments

Canary deployments involve rolling out the change to a small subset of users before proceeding with a full rollout. This canary set acts as a “canary in the coal mine,” giving an early indication of potential problems before they impact the entire user base.

AWS Services for Canary Deployments:

  • AWS CodeDeploy: Has built-in support for canary deployments, where you can specify the percentage of the fleet to deploy the application in phases.
  • Amazon API Gateway: Use staging and versioning capabilities to create a canary release for your API.

Comparison Table of Deployment Strategies

Strategy Description AWS Service Pros Cons
Blue/Green Switch traffic between two identical environments Elastic Beanstalk, CodeDeploy, Route 53 Quick rollback, immediate cutover Costs for running two environments
Rolling Update instances in batches Elastic Beanstalk, EC2 Auto Scaling Low overhead, maintains availability Longer deployment time, partial update
Canary Release to a small subset of users, then scale CodeDeploy, API Gateway Early issue detection, reduced risk Complex setup, higher management

Deploying with AWS Services

When implementing a deployment policy, administrators should not only choose the right strategy but also automate the process as much as possible. Here’s an example of how a rolling update policy can be set in an Auto Scaling group using AWS CLI:

aws autoscaling update-auto-scaling-group \
–auto-scaling-group-name my-auto-scaling-group \
–launch-configuration-name new-launch-config \
–min-size 2 \
–max-size 5 \
–desired-capacity 3 \
–vpc-zone-identifier subnet-4176792c \
–termination-policies “OldestInstance”

And with CodeDeploy, you might specify your deployment type in an appspec.yml file for canary deployments:

version: 0.0
Resources:
– TargetService:
Type: AWS::CodeDeploy::EC2/OnPremises
Properties:
Name: “MyTargetService”
Deployment:
Canary:
Steps:
– Name: “Canary10Percent30Minutes”
Action: “TrafficRouting”
WaitTimeInMinutes: 30

It’s essential to tailor the deployment strategy to the application’s needs, weighing factors like complexity, user experience, infrastructure costs, and risk tolerance. Understanding and implementing these deployment strategies are key for AWS Certified SysOps Administrators to manage robust and resilient infrastructure.

Answer the Questions in Comment Section

True/False: Rolling deployments should be avoided if your application cannot handle running multiple versions simultaneously.

Answer: True

Explanation: Rolling deployments gradually replace instances of the previous version of an application with the new version, so the application needs to support running multiple versions during the deployment.

Which deployment scenario involves shifting traffic gradually from a blue environment to a green environment?

  • a) Canary Release
  • b) A/B Testing
  • c) Blue/Green Deployment
  • d) Rolling Update

Answer: c) Blue/Green Deployment

Explanation: Blue/Green Deployment is a strategy where you have two identical environments. The ‘Blue’ is the current running version, and ‘Green’ is the new version you shift traffic towards.

True/False: Canary deployments expose all users to the new version of the application immediately.

Answer: False

Explanation: Canary deployments expose the new version to a small subset of users first, before rolling it out to the entire user base.

In a blue/green deployment, what happens after the new version is deployed to the green environment and verified?

  • a) The green environment is discarded.
  • b) Traffic is immediately shifted back to the blue environment.
  • c) Traffic is gradually shifted from the blue environment to the green environment.
  • d) The blue environment is updated to be a replica of the green environment.

Answer: c) Traffic is gradually shifted from the blue environment to the green environment.

Explanation: Once the new version in the green environment is verified as stable and functional, traffic is shifted from the blue to the green environment, at which point the green environment becomes the active production environment.

True/False: In a canary deployment, if the canary version fails, it should affect all users.

Answer: False

Explanation: Canary deployments are designed to affect only a small subset of users. If the canary version fails, it should ideally only impact that limited group, not all users.

What AWS service can be used to implement a blue/green deployment for applications running on EC2 instances?

  • a) AWS Lambda
  • b) AWS Elastic Beanstalk
  • c) AWS CodeDeploy
  • d) Amazon RDS

Answer: c) AWS CodeDeploy

Explanation: AWS CodeDeploy supports blue/green deployments directly by rerouting traffic between two sets of EC2 instances.

True/False: Blue/Green deployments require the same amount of resources during the deployment as a rolling update does.

Answer: False

Explanation: Blue/Green deployments require double the resources during the deployment because you have two complete environments running in parallel.

What is a primary benefit of implementing a canary deployment?

  • a) It is the least expensive deployment strategy.
  • b) It minimizes downtime by keeping the old version operational.
  • c) It allows for easy rollback in case of errors in the new version.
  • d) It exposes only a subset of users to the new version initially.

Answer: d) It exposes only a subset of users to the new version initially.

Explanation: The primary benefit of a canary deployment is that it minimizes the impact of any potential issues by only exposing a small group of users to the new version before a wider deployment.

True/False: AWS Elastic Beanstalk can perform rolling updates automatically.

Answer: True

Explanation: AWS Elastic Beanstalk supports rolling updates, which can be automatically managed by specifying the appropriate settings in the environment configuration.

Which deployment scenario is most suitable for critical applications requiring zero downtime?

  • a) Canary Deployment
  • b) Rolling Update
  • c) Blue/Green Deployment
  • d) All of the above

Answer: c) Blue/Green Deployment

Explanation: Blue/Green Deployment is ideal for critical applications requiring zero downtime because it allows a complete, immediate switch from the old version to the new version after testing.

True/False: Canary releases require less monitoring than blue/green deployments.

Answer: False

Explanation: Canary releases often require more extensive monitoring since the new version is released to a small subset of users, and its impact on those users must be closely tracked to decide on a wider deployment.

In a rolling update deployment scenario, when is the new application version deployed to the next set of instances?

  • a) After all instances have been updated with the new version.
  • b) Before the previous set of instances is updated with the new version.
  • c) Once the specific health checks on the updated instances pass.
  • d) It is random and not tied to the state of any specific instances.

Answer: c) Once the specific health checks on the updated instances pass.

Explanation: In a rolling update, the deployment moves through the instances in a pre-defined sequence, updating to the new version only after health checks on the previously updated instances pass. This ensures the stability of the application throughout the deployment process.

0 0 votes
Article Rating
Subscribe
Notify of
guest
21 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Mathis Roy
7 months ago

Great explanation on blue/green and canary deployments!

Susanna Lawson
7 months ago

The rolling deployment part was a bit confusing. Can someone elaborate?

Nalmir Mendes
7 months ago

Thanks for the clear breakdown!

Allan Black
8 months ago

How do you handle database migrations with blue/green deployments?

Mandy Daniels
8 months ago

Fantastic guide! Just what I needed for my studies.

Iina Nikula
7 months ago

Canary deployments seem more complex than rolling ones. Is there ever a reason to use canary over rolling?

Vicky Crawford
8 months ago

I appreciate the detailed explanations. Helped me understand these deployment strategies a lot better.

Leah Thompson
7 months ago

What AWS services support blue/green deployments?

21
0
Would love your thoughts, please comment.x
()
x