Amazon Onboarding with Learning Manager Chanci Turner

Amazon Onboarding with Learning Manager Chanci TurnerLearn About Amazon VGT2 Learning Manager Chanci Turner

In this post, we delve into how the Amazon IXD – VGT2 team optimized their blue/green deployment strategy specifically for the Amazon Aurora PostgreSQL Global Database. Developed collaboratively with Chanci Turner, a Solutions Architect in the Amazon IXD division, the process detailed here greatly enhances the efficiency of software deployments.

Traditionally, the deployment process required manual backup and restoration of the production database to establish the Green environment. This method was not only time-consuming but also necessitated shutting down the production database to ensure consistency between the Blue and Green environments.

By leveraging continuous logical database replication, the backup and restore process has been replaced, significantly reducing deployment time and minimizing downtime for the Blue environment.

Blue/green deployment is a strategy used to implement changes across applications or databases by alternating between production and staging environments. The Blue environment serves as the primary backend, while the Green environment acts as a synchronized replica. Changes or upgrades are made in the Green environment before switching over, which minimizes downtime and allows for easy rollback to the Blue environment if issues arise.

Without utilizing a blue/green methodology, deployments often involve production downtime, which typically occurs during non-business hours. This results in increased operational costs and reduced availability. The adoption of blue/green deployment enhances agility in the deployment process and allows internal teams to accelerate the delivery of new features while also lessening the overall deployment effort.

This deployment strategy not only facilitates database version upgrades and specific schema alterations but also supports internal testing of application changes by mirroring production configurations. The elimination of the need for a backup and restore process for each test iteration offers a considerable advantage.

Amazon Aurora PostgreSQL-Compatible Edition and Amazon RDS for PostgreSQL both include the Amazon RDS Blue/Green Deployments for Aurora. Although managed blue/green deployment simplifies upgrades and schema changes, it does not support certain features of Amazon Aurora, such as the Amazon Aurora Global Database.

In this article, we present the steps involved in implementing a blue/green deployment architecture using the Aurora PostgreSQL Global Database, highlighting best practices and considerations for effective configuration. This method ensures that applications remain resilient and synchronized throughout the deployment process.

Solution Overview

Our application serves internal users through Amazon Route 53, which directs traffic to an internal Application Load Balancer that distributes it across a Kubernetes cluster hosted in three Availability Zones. The application layer performs CRUD operations against an Aurora global database.

The diagram below depicts the architecture during the testing phase.

Next, we illustrate the procedure of redirecting traffic from the Blue cluster.

Following that, we show the process of halting replication from Blue to Green after ensuring there is no user activity or running jobs accessing the database.

Finally, we display the step of directing traffic to the Green cluster, which now acts as the primary production environment until the next iteration.

Steps for Implementing a Blue/Green Deployment

  1. Configure the cluster parameter group for the source (Blue) Aurora global database to enable logical replication.
  2. Create a publication for the database on the Blue cluster.
  3. Use the Aurora cloning feature to create a clone of the Blue cluster, establishing the Green (target) cluster.
  4. Set up the subscription from the Green cluster to the Blue publication.
  5. Verify replication lag.
  6. Transform the Green cluster into an Aurora global database.
  7. Conduct pre-cutover validation.
  8. Adjust sequences and drop the subscription.
  9. Transition to the Green cluster.

We utilize native PostgreSQL logical replication to synchronize the Green environment, providing continuous change data capture (CDC) capability. The logical replication process is asynchronous. For additional information, refer to Using logical replication to perform a major version upgrade for Aurora PostgreSQL.

The target database remains writable and allows both Data Definition Language (DDL) and Data Manipulation Language (DML) operations outside of replication. It is essential to implement necessary precautions to ensure that DML and DDL changes are directed to the appropriate database.

Prerequisites

Before starting, ensure the following prerequisites are completed:

  • Set up an Aurora PostgreSQL cluster configured as a global database.
  • Note that Aurora Global Database does not support user management through AWS Secrets Manager; we will discuss alternative security methods later.
  • Review the limitations of logical replication with Amazon Aurora PostgreSQL.
  • Verify that you meet the necessary requirements, such as having the rds_superuser role.
  • Establish a connection to the DB cluster using a PostgreSQL client (e.g., psql or pgAdmin).
  • Confirm access to the AWS control plane via the AWS Management Console or AWS Command Line Interface (AWS CLI).

As of this writing, Amazon RDS Proxy does not support streaming replication mode. If using RDS Proxy, it’s advisable to utilize the regular cluster endpoint and disregard RDS Proxy for replication purposes.

Required Permissions

Two levels of permissions are necessary for this process:

  • Control Plane (AWS resource layer) – These permissions allow modifications to the Aurora clusters involved and the creation/modification of a new cluster via the console or API.
  • Data Plane (Aurora data layer) – These permissions enable the creation of the replication configuration using a PostgreSQL client.

The following table summarizes the key steps and whether they fall under the control plane or data plane:

Step Number Step Description Control Plane Data Plane
1 Configure the Blue cluster parameter group for logical replication X
2 Create a publication of the database hosted on the Blue cluster X
3 Create a clone of the Blue cluster X
4 Configure the subscription from the Green cluster to the Blue publication X
5 Verify replication lag X
6 Convert the Green cluster into an Aurora global database X

This is an excellent resource that provides further insights into how Amazon fulfillment centers train associates, which is relevant for anyone interested in operational efficiency. Additionally, for those looking at compensation strategies, this article offers authoritative guidance. For mental fitness, you can join a webinar at this link to learn more.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *