Try out the B/G Deploy feature available on Amazon Aurora

This is Oniumi (@fat47) from the Service Reliability Group (SRG) of the Technology Headquarters.
#SRG(Service Reliability Group) mainly provides cross-sectional support for the infrastructure of our media services, improving existing services, launching new ones, contributing to OSS, etc.
This article is located in SRGDBWGWe will publish materials regarding the database that the (DB Working Group) provides to the entire company.
I hope this helps in some way.
 

What is the B/G Deployment function?


This is a new feature available for RDS and Aurora that was announced at the recent Re:Invent 2022.
The documentation isHere
 
I think this article from Classmethod is comprehensive and easy to understand.
 
To summarize the function flow:
  • You can easily create a mirror environment (Green) from the production environment (Blue) from the console.
  • Logical replication is established between Blue and Green, so updates are synchronized.
  • Switch from Blue to Green from the console
  • The endpoint seen by the application does not change, but the destination within the endpoint changes
  • During switching, both B and G are blocked from writing.
  • If the B/G switch is not completed within the specified time, it will automatically switch back
  • After the switch, the Blue environment will remain a standalone environment.
 
Image of the overall configuration
[AWS公式ドキュメントから画像引用]
[Image taken from AWS official documentation]

Note


The following points may cause the operation to become unstable:
The case has been reported to AWS and they are currently investigating.
💡
Confirmed bugs - If the instance size on the source side is t3.small, the B/G environment construction stops during construction. - If the subnet of the source side cluster is 2AZ, the B/G environment construction stops during construction.

B/G environment construction procedure


This time we will test upgrading MySQL version using B/G.

Enable binary logging on the blue cluster

Set "binlog_format" to MIXED or ROW in the DB cluster parameter group.
Please note that the change will require you to reboot the instance.

Creating the Green Environment

ブルー/グリーンデプロイの作成
 
Create it by specifying the identifier of the Green environment and the engine version.
 
Once creation is complete, the Blue/Green notation will be displayed as shown below.

Try switching between B/G while writing to the Blue environment every second

Create a suitable table on the Blue side and switch B/G while INSERTing every second.
 
切り替え
 
A confirmation screen will appear displaying information for each B/G.
You can set the timeout here. If the switchover is not completed within this time,
The switch will be reverted back without any changes.
切り替え
 
A notification like this will be displayed during the switch.
 
Looking at the log of the script that was writing every second during the switchover,
First, the Blue environment becomes Read Only and writing is blocked,
You can see that writing resumed about two minutes after the connection failed.

thoughts


Previously, we had to manually set up a separate cluster and configure binary log replication; but now we can do this with just one button on the console, which I thought was great.
The official announcement states that the switch was completed within one minute, but we were unable to communicate for about two minutes, so further verification is required to determine whether this was because we were using a t3.medium instance.
 
Personally, I think it would be great if the B/G revert function could be enabled even after the B/G switch has been successful. This is because after a version upgrade, problems may be discovered some time later, making it necessary to revert.
However, in that case, it would require deprecated replication from Aurora v3 to Aurora v2, so I think it might be difficult to achieve.
 
This B/G function is now generally available, but it's marked as (Beta) on the console, so we look forward to seeing how it evolves in the future.
Although I did not test it this time, I think that if the restrictions on ALTER to the Green environment were relaxed, the number of situations in which it could be used would increase.

Conclusion


SRG is looking for people to work with us! If you're interested, please contact us here!