Skip to main content
RDS Blue/Green deployments create a staging environment (green) that mirrors your production database (blue). Changes are applied and tested on the green environment, then traffic is switched over with minimal downtime — typically under one minute.

When to use Blue/Green deployments

Major version upgrades

Upgrade from one major engine version to another (e.g., PostgreSQL 16 to 17, MySQL 8.0 to 8.4) without a multi-hour maintenance window.

Schema changes

Apply DDL changes to large tables while the current version serves traffic, then switch over when replication catches up.

Instance class changes

Resize to a larger or smaller instance class with a short cutover window instead of a full instance replacement.

Parameter group changes

Test new parameter values on the green environment before applying them to production.

Variable

Limitations

  • manage_master_user_password is not supported when Blue/Green is enabled. Use password_wo and password_wo_version instead.
  • Backup retention must be at least 1 day. The module automatically coerces backup_retention_period to 1 when blue_green_update is set.
  • Not all engine versions and regions support Blue/Green deployments. Check the AWS documentation for the supported matrix.
  • The Blue/Green deployment itself (initiating, testing, and switching over) is managed through the AWS console, CLI, or SDK — Terraform only enables the feature on the instance.

Deployment workflow

1

Enable Blue/Green on the instance

Add blue_green_update = { enabled = true } to your module block and apply:
2

Create the Blue/Green deployment in AWS

Use the AWS console or CLI to create a Blue/Green deployment. AWS clones the production (blue) instance into a staging (green) environment and sets up replication between them.
3

Apply and validate changes on the green environment

With the green environment running, apply your schema changes, update parameters, or let it run under test load. Monitor replication lag to ensure the green instance stays in sync.
4

Switch over

When you are ready, initiate the switchover. AWS promotes the green instance to primary and redirects the existing DNS endpoint. The old blue instance becomes the new standby.
5

Update Terraform configuration to match the new version

After switchover, update engine_version (and family / major_engine_version if the major version changed) in your Terraform configuration so that the state matches reality:
Run terraform plan to verify no unintended changes.
6

Delete the Blue/Green deployment

Once you have validated the switchover, delete the Blue/Green deployment resource to stop paying for the standby clone.

Full example

The following examples are taken from examples/blue-green-deployment/main.tf.

PostgreSQL with Blue/Green

MySQL with Blue/Green

PostgreSQL logical replication requirement

PostgreSQL Blue/Green deployments require logical replication to be enabled. Add this to your parameters:
You will need to reboot the instance after applying this parameter before creating the Blue/Green deployment.