PostgreSQL DB Migration (On-Prem To AWS)

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

AWS DMS

AWS DMS Service:


AWS Database Migration Service (AWS DMS) is a web service you can use to migrate data from your
database that is on-premises, on an Amazon Relational Database Service (Amazon RDS) DB instance, or in
a database on an Amazon Elastic Compute Cloud (Amazon EC2) instance to a database on an AWS service.
These services can include a database on Amazon RDS or a database on an Amazon EC2 instance. You can
also migrate a database from an AWS service to an on-premises database. You can migrate between source
and target endpoints that use the same database engine, such as from an Oracle database to an Oracle
database. You can also migrate between source and target endpoints that use different database engines,
such as from an Oracle database to a PostgreSQL database.

Migration Cost
 AWS database Migration Service is a low-cost service.

 Charged for the compute resources used during the migration process called as replication instance and any
additional log storage.

 Migrating a TB a DB might cause $3.

 Applicable for both homogeneous and heterogeneous migrations of any supported databases.

Reliability of DMS:
 2 most important capabilities of the tools are resiliency and self-healing capability.

 It continually monitors:
Source and target databases
Network connectivity
Replication instance

 If interruption occurs,
It automatically restarts the process and continues the migration from where it stopped.
Multi-AZ option allows you to have high availability for database migration and continuous data
replication by enabling redundant replication instances.

Simplicity
 No Need to install any drivers or applications for migration.
 No change required for source database in most cases (except prerequisites.)
 Start migration using the AWS Management Console.
 Once the migration initiated DMS manages all the complexities of the migration process including
automatically replicating data changes that occur in the source database during the migration process.
 DMS does continuous data replication.

Downtime minimized
 Migrate your databases to AWS with virtually no downtime except during cutover.
 Change of data in source database during the migration are continuously replicated to the target database.
 IT causes the source database to be functional during the migration process.
 Post migration the target database keeps synchronized with the source for as long as you to wish to keep
running the DMS allowing you to switchover as and when required.
DMS Migration Type
Homogeneous Database Migrations via DMS
Source & target DB engines are the same or are compatible like: -
Oracle to Amazon RDS for Oracle,
MySQL to Amazon RDS for MySQL,
Microsoft SQL Server to Amazon RDS for SQL Server.

Since the schema structure, data types, database code are compatible between the source and the target
databases, this kind of migration you create a migration task with connections to the source and target
database, and then start the migration with the click of a button. AWS Database Migration Service takes care
of the rest. The source database can be located in your own premises outside of AWS, running on an
Amazon EC2 instance, or it can be an Amazon RDS database. The target can be a database in Amazon EC2
or Amazon RDS.

Heterogeneous Database Migrations via DMS

Source & Target engines are different. Like in the case of Oracle to Amazon Aurora, Oracle to
PostgreSQL and Microsoft SQL Server to MySql migrations.

PostgreSQL Migration Architect Diagram

Customers who are looking to migrate self-managed PostgreSQL databases to Amazon RDS for
PostgreSQL or Aurora PostgreSQL, can use one of the three main approaches.

 Use a native or third-party database migration method such as pg_dump and pg_restore for full
load only migrations.
 Use a managed service such as AWS Database Migration Service (AWS DMS) for full load and
ongoing replication.
 Use a native tool for full load and a managed AWS DMS service for ongoing replication. We call
this strategy the hybrid approach.

The hybrid approach provides the following advantages.

 Automation of the creation of secondary database objects such as views, indexes, and constraints.
 AWS DMS data validation to ensure that your target data matches with the source, row by row and
column by column.
 Other capabilities provided by AWS DMS,

for example, CloudWatch monitoring and table statistics.

It may be simpler to use AWS DMS to track migration progress, transactional workload,
receive and transmit throughput, source and target latency, and so on.

Migration Steps

PostgreSQL version (Source) AWS DMS version to use (Target)

9.x, 10.x, 11.x, 12.x Use any available AWS DMS version.

13.x Use AWS DMS version 3.4.3 and above.

14.x Use AWS DMS version 3.4.7 and above.

Prerequisites
 An active AWS account to create RDS and replication instance

 AWS Landing Zone Network connectivity with On-Prem datacentre.

 A PostgreSQL source database in an on-premises data centre

 Will be needing a VPC for RDS DB creation (target DB).

 Validate the source and target database version and engine.

 Identify hardware requirements for the target server instance.

 Identify storage requirements: storage type and capacity.

 Choose proper instance type capacity, storage features, and network features.

 Identify network access security requirements for source and target databases.

Native Full Load


https://docs.aws.amazon.com/dms/latest/sbs/chap-manageddatabases.postgresql-rds-postgresql-full-load.html

Ongoing Replication
https://docs.aws.amazon.com/dms/latest/sbs/chap-manageddatabases.postgresql-rds-postgresql-ongoing-
replication.html
Endpoint Requirement
Source Endpoint Configuration
 Endpoint identifier

 Source engine (PostgreSQL)

 Access to endpoint database (Credentials).

o Server name

o Port

o User name

o Password

o Secure Socket Layer (SSL) mode (required, verify-full, verify-ca)

o Database name

 KMS key (for Encryption)

 Tags

Target Endpoint Configuration


 RDS Instance (option will appear on selecting “Select RDS DB instance”)

 Endpoint identifier

 Source engine (PostgreSQL)

 Access to endpoint database (Credentials).

o Server name

o Port

o User name

o Password

o Secure Socket Layer (SSL) mode (required, verify-full, verify-ca)

o Database name

 KMS key (for Encryption)

 Tags

DB Migration Task Configuration


Once Source and Destination endpoints are created, we can go ahead and create Migration Task:

 Task identifier

 Replication instance

 Source database endpoint

 Target database endpoint

 Migration type (replicate data changes only)


 Premigration assessment (Enable or Disable): A premigration assessment warns you of potential migration
issues before starting your migration task. Premigration assessments generally have minimal impact on your
databases and take minimal time to run.

 Tags

References:
 https://www.youtube.com/watch?v=S9ogaQOvIyw

You might also like