- Newest
- Most votes
- Most comments
Hello.
RDS also has features for performing Blue/Green deployments.
How about using this feature to perform migrations and tests in an RDS Green environment before deploying to ECS?
If there are no problems afterward, you can start the ECS deployment and switch the RDS to the Green environment while the ECS deployment is in progress to minimize downtime.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/blue-green-deployments-overview.html
For handling database schema migrations in ECS Fargate blue-green deployments with CodeDeploy, the recommended approach is to decouple database schema changes from application code changes. This means treating the database as outside of the blue/green environment boundary, where it's shared between both the blue and green environments.
There are two primary strategies you can use, often in tandem:
Before Deployment (Additive Changes): Change the schema first, before the blue-green code deployment. This approach works well for additive modifications like adding new columns, fields, entities, or indexes. The critical requirement is that database schema changes must be backward compatible, meaning your old version of the application (blue environment) can still interact with the database without errors. Your application code should be developed following best practices to tolerate the presence of additional fields that it may not yet use.
After Deployment (Deletive Changes): Change the schema last, after the blue-green code deployment. This approach is used when you need to remove fields, entities, or relationships from the database. Here, your new application code changes must be backward compatible with the old schema, so the application can interact with both the previous and new version of the database schema during the transition. Note that after executing the schema change, the previous version of the application will no longer be operational, so this carries higher risk.
For your specific scenario with adding columns and indexes, you would typically use the "before deployment" approach. Run your migrations before initiating the blue-green deployment, ensuring that both your blue tasks and new green tasks can work with the updated schema. This prevents compatibility issues and allows for safer rollbacks since the blue environment remains functional throughout the process.
The key is ensuring your application code is designed to handle schema changes gracefully, and that you have strong testing and QA phases to validate compatibility before production deployment.
Sources
Best Practices for Managing Data Synchronization and Schema Changes - Blue/Green Deployments on AWS
Community | Levelling up Your Releases: Reduce Risk with Blue/Green Deployments
Community | Levelling up Your Releases: Reduce Risk with Blue/Green Deployments
Relevant content
- asked 2 years ago
- asked 2 years ago
- asked 3 years ago
- asked 2 years ago
