How to Trigger Blue-Green Deployment for AWS RDS from Terraform?

274 Views Asked by At

I'm currently working on upgrading AWS RDS postgres instance major version using blue/green deployment but I'm unsure about how to handle blue-green deployments for AWS RDS instances through the Terraform.

I have used registry code also where they specified about enabling blue green update blue_green_update = { enabled = true } https://registry.terraform.io/modules/terraform-aws-modules/rds/aws/latest/examples/blue-green-deployment Could anyone provide guidance on how to achieve blue-green deployments for AWS RDS using Terraform?

I am expecting provisioning Blue-Green Deployment for AWS RDS from Terraform

1

There are 1 best solutions below

0
marszczybrew On

If you have, as mentioned, added the following code snippet inside of your resource "aws_db_instance" then planning & applying is the only thing you need to do. Enabling this configuration option for the first time will also result in a new deployment being triggered, even if you leave all the settings unchanged (parameter groups, server version, etc).

  blue_green_update {
    enabled = var.db_blue_green_update_enabled
  }

AWS Terraform provider will take care of:

  • provisioning the green instance
  • syncing it with the blue instance
  • triggering the switchover
  • deleting the old instance

No interaction from operator side is needed during this operation.

From my experience the only noticeable impact was that a batch worker connected to the (likely) old instance for a few seconds after the switchover and couldn't modify any data because it was already in readonly mode at that time.