AWS Database Blog

AWS Database Migration Service and AWS Schema Conversion Tool now support IBM Db2 LUW as a source

Managing and operating relational databases is a basic piece of maintaining an effective business. Relational databases come in many flavors—commercial (Oracle, Microsoft SQL Server, IBM Db2, and so on) and open source (MySQL, PostgreSQL, and so on). With innovation and improvements in the open-source database world and cloud computing platforms like AWS, many enterprises are moving from proprietary (OLTP) database engines such as Oracle to open-source engines. Services like the AWS Database Migration Service (AWS DMS) and the AWS Schema Conversion Tool (AWS SCT) help with migrating commercial to open-source databases in AWS with minimal downtime.

Migrations from commercial to open-source databases typically take multiple steps, but we discuss two important parts following:

  • Using AWS SCT to convert objects (tables, indexes, constraints, functions, and so on) from the source commercial engine to the open-source engine.
  • Using AWS DMS to move data into the appropriate converted objects and keep the target database in complete sync with the source. Doing this takes care of the production workload while the migration is ongoing.

We’re making an ongoing push to add more automation for both these steps, based on experience and customer feedback. As part of that, we’re excited to launch support in AWS SCT to convert objects from IBM Db2 for Linux, UNIX, and Windows (LUW) to any supported open-source databases in AWS. Those include Amazon RDS for PostgreSQL, RDS for MySQL and Amazon Aurora (MySQL and PostgreSQL compatible).

At the same time, we are also happy to announce general availability of IBM Db2 for LUW as a source for AWS DMS. This availability means we can use AWS DMS to migrate to any AWS DMS–supported targets from Db2 for LUW. These features are designed to help you migrate off of your Db2 for LUW databases and keep a leg in the cloud.

Background

AWS SCT helps in converting database dictionaries and secondary objects to any supported database target with minimal work. AWS SCT creates a migration assessment report that points out objects and code that require manual change or rework. The assessment report also helps assess the amount of manual work required and gives you details on the assessment for all targets. AWS SCT is frequently updated with new features, and our release notes keep you informed about enhancements.

Now that IBM Db2 for LUW is a supported database source for AWS SCT, some features that we support for Db2 as a source are these:

  • Db2 for LUW version 9.7s and later are supported. Find more details in Sources for Data Migration in the AWS DMS documentation.
  • The following targets are supported:
    • RDS for MySQL
    • Aurora MySQL
    • RDS for PostgreSQL
    • Aurora PostgreSQL
  • Conversion over a Secure Sockets Layer (SSL) connection is also supported.

AWS DMS helps you migrate databases to AWS quickly and securely. You can migrate your data to and from most widely used commercial and open-source databases, such as Oracle, Microsoft SQL Server, and PostgreSQL. The service supports homogeneous migrations such as Oracle to Oracle, and also heterogeneous migrations between different database platforms, such as Oracle to PostgreSQL or MySQL to Oracle.

Now that IBM Db2 for LUW is a supported database source in AWS DMS, some features that we support for Db2 as a source in the initial launch are these:

  • Db2 for LUW versions 9.7 and later are supported. Find more details in Sources for Data Migration in the AWS DMS documentation.
  • Migrating data to all AWS DMS supported targets is supported.
  • Migrating data using SSL connectivity (including certificate-based authentication) is supported.
  • Replicating ongoing changes is supported.

Let’s look at the process of migrating a Db2 database to an open-source database using AWS SCT and AWS DMS.

Using AWS SCT for migrating your data

You can use AWS SCT to do migration from a Db2 for LUW source database to any of the targets listed preceding. Using AWS SCT, you can export the source database object definitions such as schema, views, stored procedures, and functions. You can download the latest version of AWS SCT from Installing, Verifying, and Updating the AWS Schema Conversion Tool in the AWS SCT documentation.

To start using AWS SCT, create a new project. Set Source database engine to MySQL and Target database engine to Amazon RDS for MySQL (if you’re migrating to RDS for MySQL).

After doing this, specify the connection parameters to the source database.

Keep these things in mind when creating a source endpoint for IBM Db2 in AWS SCT:

  • Download the JDBC driver from the IBM website. The driver version should be 4.22.0 or later.
  • You can also connect to the IBM Db2 instance using SSL. You can configure SSL in the SSL field in the taskbar, just as you configure any other client for SSL connections to Db2.

After that, you need to configure the endpoint for the target.

To export the database object definition from the source database, open the context (right-click) menu for the schema that you want to export and choose Convert Schema.After the conversion is done, go to the target database section in AWS SCT and save the .sql file containing the database object definitions.

You might have to make a few edits in the AWS SCT .sql file. We recommend that the schema generated by AWS SCT for your target instance be the same as the code that you have on your Db2 source. Alternatively, you can also choose to have AWS SCT apply the converted schema directly on the target instance to prepare for the data migration stage.

Using AWS DMS for migrating your data

Now that you have migrated all the database code and objects to the target database of choice, you can migrate your data using AWS DMS. AWS DMS can do a one-time data migration, or it can do a continuous replication of the data from IBM Db2 to any supported targets. These targets include relational databases (such as Oracle and Amazon Aurora), a data warehouse (Amazon Redshift), a NoSQL database (Amazon DynamoDB), or an Amazon S3 bucket. With this release, we also support SSL connectivity (verify-ca) for IBM Db2 databases.

How to add an IBM Db2 database as a source

Follow these steps to add a Db2 database source to AWS DMS:

  1. Sign in to the AWS Management Console, and choose Database Migration Service.
  2. In the navigation pane, choose Endpoints, and then choose Create Endpoint.
  3. Choose the following:
    • Endpoint type: Source
    • Source engine: Db2 (IBM Db2 for LUW Database)
  4. Enter information for the Db2 Server Name and associated Port.
  5. When doing migrations using AWS DMS, you can also choose to encrypt connections to your Db2 source by using SSL. To do so, you can use the AWS DMS Management Console or AWS DMS API to assign a certificate to an endpoint. You can also use the AWS DMS console to manage your certificates. With am IBM Db2 source, we support only the following SSL connectivity:
    • verify-ca – The connection is encrypted and AWS DMS verifies the server certificate.
  6. Set the remaining parameters as you do when connecting to any other relational database.

You can also create the endpoint for Db2 using the following AWS CLI command:

aws dms create-endpoint --endpoint-identifier test-endpoint-1 --endpoint-type source --engine-name Db2 --username admin --password password --server-name Db2.server.com –port 8192

Conclusion

We believe that these new features should help anyone who wants to migrate off of Db2 for LUW to AWS. This migration can help you to get to know the power of cloud computing and AWS. It also can help you save on operating costs by moving from a heavily charged licensed database into an open-source engine in AWS. When your data is in AWS, you can use a plethora of services to achieve the mission and vision of your organization through your data.

Feel free to drop us questions in the comments section. Happy migrating!


About the Author

Abhinav Singh is a database engineer in Database Migration Service at Amazon Web Services. He works with our customers to provide guidance and technical assistance on database migration projects, helping them improve the value of their solutions when using AWS.