
Levelling up Your Releases: Reduce Risk with Blue/Green Deployments
Deploying to production is a critical step in the software deployment lifecycle. One approach to reduce risk is blue/green deployments.
- Validate the new update by sending test traffic (e.g. a small sample of production users)
- Run smoke tests to verify important functions prior to release
- Rollback to the previous version in the blue environment if things don’t go as planned
- Before deployment (additive): The schema is changed first, before the blue/green deployment. Here, database schema changes must be backwards compatible, whereby the previous version of the application can still interact with the database without any errors. For example, this may be where you add new fields, entities or relationships to the database.
- After deployment (deletive): The schema is changed last, after the blue/green deployment. Here, application code changes must be backwards compatible, whereby the application can interact with both the previous and new version of the database schema. For example, this may be where you remove fields, entities or relationships from the database. After executing the schema change, the previous version of the application will no longer be operational.
- For Amazon ECS, you use blue/green deployment with CodeDeploy.
- For AWS Lambda, you use AWS Serverless Application Model (SAM) which comes built-in with CodeDeploy.
- Configure how traffic is shifted. As per the links above, this includes all-at-once where you shift all traffic to the new version, linear where you shift traffic in equal increments, or canary where traffic is shifted in two increments enabling you to test with a small percentage of traffic prior to full release.
- Integrate to your CI/CD pipeline. For example, Github Actions or Amazon CodePipeline.
- Test automation using lifecycle event hooks. For example, you incorporate smoke tests into the
BeforeAllowTraffic
hook.



Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.