DEV Community

Girish Mukim
Girish Mukim

Posted on • Updated on

Blue/Green Deployments in Amazon Aurora and Amazon RDS. How it Looks?

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.

Image description

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.

Error

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.

turn on binary logging

Select the database that needs to be updated in the console and click Create Blue/Green Deployment under the Actions dropdown menu.

Image description

Provide 'Blue/Green Deployment Identifier' and chose current DB version itself.

Image description

Image description

Click 'Create Staging Environment'.

Image description

Oops..got this error

Image description

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.

Image description

Image description

Let's try to create blue/green deployment again.

Image description

Notice existing cluster changed to Blue and new one is created as Green.

Blue Green Deployment Ready

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.

Switchover Action

Pre-Switchover

Pre-Switchover

Default timeout was 5 minutes and I changed it to 15 just incase as trying this option the first time. Then click switchover.

Pre-Switchover

RDS is Switching over

Switching over

RDS Page gone unresponsive for a bit -

Page unresponsive

Reloaded webpage and hurrey, Switchover Completed !!!

Image description

Look at the Blue/Green Deployment details -

Switchover Completed

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.

Delete old database

Delete old database

Delete old database

All done !!

Final Look

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 -

P.S. AWS Announcement for your quick reference

Top comments (0)