Migrate from IBM Db2 on Amazon EC2 to Aurora PostgreSQL-Compatible using AWS DMS and AWS SCT - AWS Prescriptive Guidance

Migrate from IBM Db2 on Amazon EC2 to Aurora PostgreSQL-Compatible using AWS DMS and AWS SCT

Created by Sirsendu Halder (AWS) and Abhimanyu Chhabra (AWS)

Environment: PoC or pilot

Source: IBM Db2

Target: Aurora PostgreSQL-Compatible

R Type: Re-architect

Workload: IBM

Technologies: Migration; Databases

AWS services: Amazon Aurora; AWS DMS; AWS SCT

Summary

This pattern provides guidance for migrating an IBM Db2 database on an Amazon Elastic Compute Cloud (Amazon EC2) instance to an Amazon Aurora PostgreSQL-Compatible Edition DB instance. This pattern uses AWS Database Migration Service (AWS DMS) and AWS Schema Conversion Tool (AWS SCT) for data migration and schema conversion.

The pattern targets an online migration strategy with little or no downtime for a multi-terabyte IBM Db2 database that has a high number of transactions. We recommend that you convert the columns in primary keys (PKs) and foreign keys (FKs) with the data type NUMERIC to INT or BIGINT in PostgreSQL for better performance. 

Prerequisites and limitations

Prerequisites

  • An active AWS account 

  • A source IBM Db2 database on an EC2 instance

Product versions

  • DB2/LINUXX8664 version 11.1.4.4 and later

Architecture

Source technology stack 

  • A Db2 database on an EC2 instance  

Target technology stack

  • An Aurora PostgreSQL-Compatible version 10.18 or later DB instance

Database migration architecture 

Using AWS DMS to migrate from IMB Db2 on Amazon EC2 to Aurora PostgreSQL-Compatible.

Tools

  • AWS Database Migration Service (AWS DMS) helps you migrate databases into the AWS Cloud or between combinations of cloud and on-premises setups. The source database remains fully operational during the migration, minimizing downtime to applications that rely on the database. You can use AWS DMS to migrate your data to and from the most widely used commercial and open-source databases. AWS DMS supports heterogeneous migrations between different database platforms, such as IBM Db2 to Aurora PostgreSQL-Compatible version 10.18 or higher. For details, see Sources for Data Migration and Targets for Data Migration in the AWS DMS documentation.

  • AWS Schema Conversion Tool (AWS SCT) supports heterogeneous database migrations by automatically converting the source database schema and a majority of the database code objects, including views, stored procedures, and functions, to a format that's compatible with the target database. Any objects that are not automatically converted are clearly marked so that they can be manually converted to complete the migration. AWS SCT can also scan the application source code for embedded SQL statements and convert them. 

Epics

TaskDescriptionSkills required

Create an Aurora PostgreSQL-Compatible DB instance.

To create the DB instance, follow the instructions in the AWS documentation. For engine type, choose Amazon Aurora. For edition, choose Amazon Aurora PostgreSQL-Compatible Edition.

The Aurora PostgreSQL-Compatible version 10.18 or later DB instance should be in the same virtual private cloud (VPC) as the source IBM Db2 database.

Amazon RDS
TaskDescriptionSkills required

Install and verify AWS SCT.

  1. Install AWS SCT by following the steps in the AWS SCT documentation.

  2. Verify the installation by following the procedures in the AWS SCT documentation.

AWS administrator, DBA, Migration engineer

Start AWS SCT and create a project.

To start the AWS SCT tool and create a new project to run a database migration assessment report, follow the instructions in the AWS SCT documentation.

Migration engineer

Add database servers and create a mapping rule.

  1. Add source and target database servers by following the instructions in the AWS SCT documentation.

  2. Create a mapping rule to define the target database platform for your source database. For instructions, see the AWS SCT documentation.

Migration engineer

Create a database migration assessment report.

Create the database migration assessment report by following the steps in the AWS SCT documentation.

Migration engineer

View the assessment report.

Use the Summary tab of the database migration assessment report to view the report and analyze the data. This analysis will help you determine the complexity of the migration. For more information, see the AWS SCT documentation.

Migration engineer

Convert the schema.

To convert your source database schemas:

  1. On the AWS SCT console, choose View, and then Main view.

  2. Select the object or parent node from your source schema, open the context (right-click) menu, and then choose Convert schema.

For more information, see the AWS SCT documentation.

Migration engineer

Apply the converted database schema to the target DB instance.

  1. Choose the schema element in the right panel of your project that displays the planned schema for your target DB instance. 

  2. Open the context (right-click) menu for the schema element, and then choose Apply to database.

For more information, see the AWS SCT documentation.

Migration engineer
TaskDescriptionSkills required

Set up a VPC and DB parameter groups.

Set up a VPC and DB parameter groups, and configure the inbound rules and parameters required for migration. For instructions, see the AWS DMS documentation.

For the VPC security group, select both the EC2 instance for Db2 and the Aurora PostgreSQL-Compatible DB instance. This replication instance must be in the same VPC as the source and target DB instances.

Migration engineer

Prepare source and target DB instances.

Prepare the source and target DB instances for migration. In a production environment, the source database will already exist.

For the source database, the server name must be the public Domain Name System (DNS) of the EC2 instance where Db2 is running. For user name, you can use db2inst1 followed by the port, which will be 5000 for IBM Db2.

Migration engineer

Create an Amazon EC2 client and endpoints.

  1. Create an Amazon EC2 client. You use this client to populate your source database with data to replicate. You also use this client to verify replication by running queries on the target database.

  2. Create endpoints for the source database and target DB instance to use for the next steps. For instructions, see the AWS DMS documentation. You must create separate endpoints for the source and target databases. For Aurora PostgreSQL-Compatible version 10.18 or later, the port will be 5432, and you can get the server name from the DB instance’s endpoint.

Migration engineer

Create a replication instance.

Create a replication instance by using the AWS DMS console and specify the source and target endpoints. The replication instance performs the data migration between the endpoints. For more information, see the AWS DMS documentation.

Migration engineer

Create an AWS DMS task to migrate the data.

Create a task to load the source IBM Db2 tables to the target PostgreSQL DB instance by following the steps in the AWS DMS documentation.

  • For source and target, use the source and destination endpoint names.

  • The migration type can be full load.

  • For the schema rule, you can use the inst1 schema from the Db2 database.

  • For the table name, specify % to migrate all tables. When the load is complete, you’ll see the Db2 tables of the inst1 schema appearing in the Aurora PostgreSQL-Compatible database.

Migration engineer

Related resources

References

Tutorials and videos