Today AWS announced Blue/Green Deployment in Amazon Aurora and Amazon RDS; I decided to explore it a bit.
Mind you! the deployment is unavailable for all the database engines supported by RDS. Amazon RDS Blue/Green Deployments is available today on Amazon Aurora with MySQL Compatibility 5.6 or higher, Amazon RDS for MySQL major version 5.6 or higher, and Amazon RDS for MariaDB 10.2 and higher.
I would suggest, refer AWS documentation for the latest version support information Here.
Let's see how to set up and use the deployment option.
Current Aurora MYSQL cluster -
Used Dev/Test cluster, didn't use production cluster for the exercise. No points guessing why I chose so. The good thing is that the Blue/Green deployment is not restricted to the production systems alone.
To use a Blue/Green Deployment in your Aurora MySQL DB cluster, you should turn on binary logging, changing the value for the binlog_format parameter from OFF to MIXED in the DB cluster parameter group.
If binlog_format is OFF, you can expect this error message while creating Blue/Green deployment.
If using default cluster parameter group, then create new cluster parameter group with binlog_format parameter value as MIXED and change your Aurora MySQL cluster parameter group to new one.
Select the database that needs to be updated in the console and click Create Blue/Green Deployment under the Actions dropdown menu.
Provide 'Blue/Green Deployment Identifier' and chose current DB version itself.
Click 'Create Staging Environment'.
Oops..got this error
Have changed Cluster parameter group but haven't rebooted primary database.
After you change the DB cluster parameter group associated with a DB cluster, reboot the primary DB instance in the cluster to apply the changes to all of the DB instances in the cluster.
Let's try to create blue/green deployment again.
Notice existing cluster changed to Blue and new one is created as Green.
Now you are nearly ready to switch over your green databases to production. Check the settings of your green databases to verify that they are ready for the switchover. You may also set a timeout setting to determine the maximum time limit for your switchover. If Blue/Green Deployments’ switchover guardrails detect that it would take longer than the specified duration, then the switchover is canceled, and no changes are made to the environments.
Choose deployment name where role is "Blue/Green Deployment". Green field will have the same setup as of original configuration in terms of writer, reader, replicas or Multi-AZ database.
Default timeout was 5 minutes and I changed it to 15 just incase as trying this option the first time. Then click switchover.
RDS Page gone unresponsive for a bit -
Reloaded webpage and hurrey, Switchover Completed !!!
Look at the Blue/Green Deployment details -
After switchover, Blue/Green Deployments does not delete your old production environment. You may access it for additional validations and performance/regression testing, if needed.
You should remove old environment manually to avoid incurring charges.
All done !!
Blue/Green Deployment for Amazon Aurora and Amazon RDS looks to be a great feature. The further testing is warranted, specially when Green field is not exactly the same as Blue i.e. what if database version is higher than original or some other changes. Let's try few more scenarios....next time !!
If you are a fan of video content then please watch blue/green deployment in action here -
Top comments (0)