Blue-green deployment lets you upgrade your RDS MySQL instance with minimal downtime by cloning the production environment (blue) into a synchronized testing environment (green). Traffic is switched by remapping the virtual IP (VIP), requiring no application changes and enabling fast rollbacks.
The blue-green deployment feature is currently available only to allowlisted users. To use this feature, submit a ticket.
Overview
Introduction
A blue-green deployment creates two identical environments: a blue environment (old version) and a green environment (new version). The blue environment serves live traffic, while the green environment is used for pre-upgrade testing. A bidirectional Data Transmission Service (DTS) link keeps both environments synchronized. The green instance has the same specifications as the blue instance.
-
Blue environment: The production environment that is currently serving live traffic and allows both read and write operations.
-
Green environment: The testing environment, which is read-only.
This approach lets you quickly identify potential defects, optimize database performance, and introduce updated database features with minimal, controllable downtime.
If issues arise, you can quickly revert to the previous version, improving upgrade reliability and reducing business impact.
Use cases
A typical use case is upgrading the major or minor engine version. The upgrade process is as follows:
-
Deploy the new version:
-
Create a green environment and select the new database version. The green environment serves as a testing environment and does not handle production traffic.
-
You can perform comprehensive functional and performance testing in the green environment to ensure the stability of the new version.
-
-
Switch between the blue and green environments:
-
After the new version is validated, switch from the blue environment to the green environment.
-
The instance ID and endpoint of the blue environment remain unchanged during and after the switch, simplifying the process.
-
-
Monitor and roll back:
-
If a critical issue occurs after the new version goes live, you can immediately switch back to the old version.
-
The rollback process is fast, significantly reducing failure recovery time.
-
-
Fix issues and redeploy:
-
After you fix the issues in the new version, you can redeploy it to the green environment for another round of validation.
-
After validation is successful, switch from the blue environment to the green environment again.
-
Benefits
-
Zero-downtime release: Upgrades are performed by switching traffic. The instance ID and endpoint in the production environment remain unchanged, so connections are maintained without requiring application changes.
-
Rapid rollback: If an issue occurs with the new version, you can simply switch back to the old version without needing to redeploy or fix the issue.
-
Resource isolation: The new and old versions run in separate, isolated environments to prevent them from interfering with each other.
-
High availability: The redundant deployment ensures that sufficient resources are available to handle requests, even during a traffic switch.
Prerequisites
The blue instance (production environment) must meet the following requirements:
-
The instance is of the High-availability Edition and does not have read-only instances or analytical instances.
-
The instance storage type is Premium Local SSD, Premium ESSD, or ESSD.
-
The instance does not have the following features enabled: database proxy, SSL encryption, disk encryption, column encryption, storage compression, Buffer Pool Extension (BPE), I/O performance burst, or data archiving.
Billing
-
Blue instance: When you create a blue-green deployment, an existing instance is designated as the blue instance (production environment instance). This instance is billed as usual.
-
Green instance: When you create a blue-green deployment, a new green instance is created. This instance is billed on a pay-as-you-go basis. Its billing rules are the same as those for a regular pay-as-you-go RDS instance.
-
Starting August 1, 2025, green instances created through a blue-green deployment are free of charge for 15 days from their creation. After 15 days, they are billed on a pay-as-you-go basis. The end date of this promotion is to be determined and will be announced separately.
-
You can change the billing method of the green instance to subscription. However, the 15-day free trial is available only when the instance is billed on a pay-as-you-go basis. After you change the billing method to subscription, the instance is charged based on subscription rules immediately after the change.
Limitations
-
After a blue-green deployment is created, the following operations are not supported on the blue or green instances:
-
Configuration change restrictions: You cannot change the instance specifications, storage capacity, storage type, or zone.
-
Feature usage restrictions:
-
Data encryption features not supported: SSL encryption, disk encryption, column encryption, and transparent data encryption (TDE).
-
Premium ESSD features not supported: Buffer Pool Extension (BPE), I/O performance burst, and data archiving.
-
Unsupported feature: Global Active Database.
-
-
Database operation restrictions: You cannot create or delete databases, or upgrade the major engine version or minor engine version of the databases.
-
Public endpoint restrictions: You cannot apply for or release a public endpoint.
-
-
After a blue-green deployment is created, if the DTS link is deleted, you cannot switch between the blue and green environments. In this case, you must first delete the blue-green deployment and then create a new one.
-
If the binlog of the blue instance is consumed by a downstream system, such as DTS or Flink, we do not recommend using a blue-green deployment. This is because the GTID sets of the blue and green instances are inconsistent, which may interrupt downstream binlog synchronization.
-
DDL operation restrictions during data synchronization: Avoid performing DDL operations (such as creating, altering, or dropping tables, or creating or dropping indexes) during data synchronization. For example, when you upgrade across major versions, DDL statements may cause synchronization errors due to incompatibilities in character sets, collations, syntax, or similar factors. Manually verify any resulting data discrepancies before use.
-
When you use a blue-green deployment to upgrade a major engine version, the following upgrade paths are currently supported:
-
MySQL 5.6 to MySQL 5.7.
-
MySQL 5.6 to MySQL 8.0.
-
MySQL 5.7 to MySQL 8.0.
-
Create a blue-green deployment
To create a blue-green deployment, specify a source instance as the blue environment.
-
Go to the RDS Instances page, select a region, and then click the ID of the target instance. This instance will become the blue instance in the blue-green deployment.
-
In the left-side navigation pane, choose Blue-green Deployment and click Create Blue-green Deployment in the upper-left corner.
-
Select a Major Engine Version for the green instance (testing environment).
-
Click Authorize and then click OK to complete the authorization of the service-linked role (SLR).
-
Select a Minor Engine Version for the green instance and click Create.
-
In the Confirm Blue-green Deployment Configuration dialog box, click OK.
Switch a blue-green deployment
During the switch, instances using Premium Local SSD and Premium ESSD experience one and two transient disconnections, respectively. We recommend that you perform this operation during off-peak hours and ensure that your application has a reconnection mechanism.
-
Confirm switch conditions: Before you switch a blue-green deployment, both the blue and green instances must meet the following requirements:
-
The instance is in the Running state.
-
No read-only instances exist.
-
The database proxy feature is not enabled.
-
The number and names of databases are identical on both instances.
-
The number and names of database accounts are identical on both instances.
-
The DTS synchronization latency is less than 5 seconds.
-
-
Switch the blue-green deployment:
-
Go to the RDS Instances page, select a region, and click the ID of the blue instance.
-
In the left-side navigation pane, choose Blue-green Deployment and click Switchover in the Blue-green Deployment Synchronization Information section.
-
Confirm the information, set the Switching Time, and click OK. The system checks the status and configuration of the blue and green instances.
-
If the switch conditions are not met, resolve the issues based on the check results and then perform the switch operation again.
-
If the switch conditions are met, the instance status changes to Blue-green Deployment Switching. After the switch is complete, the instance status changes to Running.
-
-
Delete a blue-green deployment
You can delete a blue-green deployment in one of the following ways:
-
Delete Blue-green Deployment:
-
Both the blue and green instances remain operational, and the limitations of the blue-green deployment are removed.
-
The green instance becomes a regular instance. It continues to use the pay-as-you-go billing method and can be converted to subscription.
-
-
Delete the blue-green deployment relationship and the green instance:
-
The green instance is released.
-
The blue instance is not affected and remains operational. The limitations of the blue-green deployment are removed.
-
-
Go to the RDS Instances page, select a region, and click the ID of the blue instance.
-
In the left-side navigation pane, choose Blue-green Deployment and click Delete in the Blue-green Deployment Synchronization Information section.
Appendix 1: Endpoint switch principle
The endpoint switch redirects user traffic from the blue environment to the green environment by remapping the virtual IP (VIP) to a different real server (RS), as shown in the following figure:
-
VIP: The entry point for users to access the service.
-
RS: The specific instance that provides the service.
By modifying the VIP-to-RS mapping, you direct traffic to the new environment. For example, the VIP pointing to the blue instance is remapped to the green instance during a switch.
Appendix 2: Pre-switch checks and error messages
|
Check item |
Error message |
Description |
|
Status check (Status-Check) |
The instance status must be 'Running'. |
The database instance must be in the 'Running' state. |
|
Table count (Table-Count) |
The table counts between the blue and green instances are different. |
The table counts differ between the blue and green instances. |
|
DTS status (DTS-Status) |
DTS status is not synchronizing. |
The DTS link is not in the Synchronizing state. |
|
DTS latency (DTS-Delay) |
DTS delay is greater than 5 seconds. |
The DTS synchronization latency is greater than 5 seconds. |
|
Read-only instances (ReadOnly) |
|
|
|
Database proxy |
|
|
|
Endpoints |
|
|
|
Databases (databases) |
|
|
|
Database accounts (accounts) |
|
|