3.3.1. Deployment Strategies (Blue/Green, Canary for Dev)
First Principle: Application deployment strategies (e.g., Blue/Green, Canary) manage the risk of introducing new code into production, prioritizing minimal downtime and controlled exposure for reliable releases.
For developers, choosing the right deployment strategy ensures that their new code is released smoothly and safely to users, minimizing disruption and enabling quick rollbacks if issues arise.
Key Application Deployment Strategies:
- In-place Deployment: (Updates application directly on existing servers.)
- Pros: Simple.
- Cons: Downtime, higher risk of issues.
- Rolling Update: (Gradually replaces old versions with new ones in a phased manner.)
- Pros: Reduces downtime compared to in-place.
- Cons: Rollbacks can be complex, potential for mixed environments.
- Blue/Green Deployment: (Runs two identical production environments, "Blue" (old version) and "Green" (new version), and shifts traffic when the new version is validated.)
- Pros: Near-zero downtime, instant rollback (switch traffic back to "Blue"), ideal for critical applications.
- Cons: Requires provisioning double the resources.
- Canary Deployment: (Rolls out a new version of an application to a small percentage of users first, then gradually to all users if it performs well.)
- Pros: Minimizes impact of issues to a small subset of users, real-world testing.
- Cons: More complex to implement traffic shifting and monitoring.
- AWS Services: AWS CodeDeploy supports Blue/Green and Canary deployments for EC2, ECS, and Lambda. Lambda aliases enable traffic shifting for Lambda functions.
Scenario: You need to deploy a new feature to your critical web application. You want to ensure minimal downtime and have the ability to immediately revert to the previous version if the new feature causes any issues after launch.
Reflection Question: How does choosing a deployment strategy like Blue/Green or Canary fundamentally manage the risk of introducing new code into production, prioritizing minimal downtime and controlled exposure for reliable application releases?