AWS Database Blog

Accelerate database migration using virtual target mode in AWS DMS Schema Conversion

Database migrations require careful planning and assessment before implementation. AWS recently announced virtual target mode in AWS Database Migration Service (AWS DMS) Schema Conversion. This feature helps you start migration planning without provisioning target databases. It is especially valuable during the discovery and design phases, where early visibility into migration-level effort and readiness can help you plan more effectively. By starting early migration tasks before the target is provisioned, you can reduce the need for these resources in the initial stages, helping you use your environment more efficiently and manage cost more effectively.

In this post, we show you how to get started using virtual target mode in AWS DMS Schema Conversion.

Solution overview

As of this writing, virtual target mode supports Amazon Aurora and Amazon Relational Database Service (Amazon RDS), including Amazon RDS for DB2, Amazon RDS for MySQL, Amazon RDS for PostgreSQL, Amazon Aurora MySQL-Compatible Edition, Amazon Aurora PostgreSQL-Compatible Edition, and Amazon Redshift. It is available in AWS Regions where AWS DMS Schema Conversion is supported.

In the next sections, we show you how to configure the virtual target mode to provide an early start by assessing and converting your database objects, helping you accelerate your migration even before the target database is provisioned. We demonstrate how to use AWS DMS Schema Conversion to assess and convert an RDS for SQL Server database to a virtual target of Aurora PostgreSQL-Compatible, and then switch from the virtual target to the actual target database when your database is available.The high-level steps are as follows:

  1. Create the target data provider with virtual mode.
  2. Create and launch a migration project.
  3. Assess and convert database objects with the virtual mode data provider.
  4. Transition the virtual target to the actual target database:
    1. Close the migration project.
    2. Reconfigure the target data provider with the actual target database.
    3. Reconfigure the migration project with the actual target database.
    4. Launch the migration project.
    5. Apply converted code to the actual target database.

Prerequisites

To set up AWS DMS Schema Conversion, you must complete multiple configuration steps. For detailed instructions to plan, configure, create and launch your database migration project using AWS DMS Schema Conversion, refer to prerequisites section of the AWS DMS Schema Conversion user guide.

Create a target data provider with virtual mode

Virtual mode is currently available within the target data provider. It stores the target database type for AWS DMS Schema Conversion to perform migration activities. Configure your virtual target data provider with the following steps:

  1. On the AWS DMS console, choose Data providers in the navigation pane.
  2. Choose Create data provider.
  3. For Name, enter a name (for example, virtual-target).
  4. For Purpose, select Schema conversion.
  5. For Engine type, choose Amazon Aurora PostgreSQL.
  6. For Virtual Mode, select Turn on Virtual Mode.
  7. For Virtual Mode connection settings, keep the default values.
  8. Choose Create data provider.

Create a migration project

You can use the virtual target data provider in your new migration project with the following steps:

  1. On the AWS DMS console, choose Migration projects in the navigation pane.
  2. Choose Create migration project.
  3. For Name, enter a name to identify your migration project (for example, demo-virtual-target).
  4. For Project purpose, select Schema conversion.
  5. For Instance profile, choose the instance profile you created in the prerequisite steps.
  6. In the Data providers section, enter the source provider and the target provider created earlier, AWS Secrets Manager secret, and AWS Identity and Access Management (IAM) roles.
  7. In the S3 bucket access settings section, enter the Amazon Simple Storage Service (Amazon S3) URL and choose the applicable IAM role.
  8. Choose Create migration project.

Launch a schema conversion project

Complete the following steps to launch your schema conversion project:

  1. On the AWS DMS console, open the migration project you created.
  2. Choose Launch schema conversion.

    When your schema conversion project is ready, you will see the virtual server appear in the tree view on the right side of the console. You have two main options for your selected database objects: you can either generate a migration assessment report or begin the conversion process.

  3. To create an assessment report, choose Actions and choose Assess from the dropdown menu.
  4. After the assessment report is created and available on the AWS DMS console, you can export it to an S3 bucket.
  5. When you’re ready to begin conversion, locate and select your desired object in the source tree. Then choose Actions and choose Convert from the dropdown menu.
  6. You can export the converted code to the S3 bucket. Navigate to the virtual target tree, choose Action, and choose Save as SQL from the dropdown menu.
  7. Choose Save as SQL to confirm.

Transition to the actual target database

When your target database is ready, you have two options for applying the converted code: you can either apply it yourself or let AWS DMS Schema Conversion apply it for you. To have AWS DMS Schema Conversion apply the converted code, you must update your target data provider settings from the virtual target to the actual target database and update the associated migration project accordingly. Complete the following steps:

  1. Close the associated schema conversion project:
    1. On the AWS DMS console, open your migration project.
    2. On the Schema conversion tab, choose Close schema conversion.

  2. Update the target data provider settings:
    1. Choose Data providers in the navigation pane.
    2. Locate your virtual data provider and choose Modify.
    3. Deselect Turn on Virtual Mode.

    4. For Server name, enter the server name from your RDS instance.
    5. For Port, enter the port from your RDS instance.
    6. For Database name, enter a name from your RDS instance.
    7. Choose Save changes.
  3. Update the migration project settings:
    1. Locate your migration project and choose Modify.
    2. For Secret, choose the secret associated to your actual target database.
    3. Choose Save changes.
  4. Relaunch the migration project.

    The target tree switches to regular (non-virtual) mode, and AWS DMS Schema Conversion resumes its standard operations. All following actions will function normally as they would in a regular, non-virtual environment.

  5. Apply the converted code:
    1. Locate and open the desired object in the target tree.
    2. Choose Action and choose Apply changes from the dropdown menu.

Clean up

When the migration is complete, you can clean up the AWS DMS Schema Conversion resources:

  1. Delete the AWS DMS Schema Conversion migration project:
    1. On the AWS DMS console, open your migration project.
    2. Choose Close schema conversion.
    3. Choose Delete.
  2. In the Data providers section, select the source and target data providers that you want to clean up, then choose Delete.

Conclusion

In this post, we demonstrated how to enable virtual mode in AWS DMS Schema Conversion to assess and convert your database objects before the target database is available. We also covered the steps to transition from virtual mode to the actual target database when it becomes available, including how to apply the converted code to the actual database using AWS DMS Schema Conversion.

To learn more, refer to Converting database schemas using DMS Schema Conversion.


About the authors

Nelly Susanto

Nelly Susanto

Nelly is a Principal Database Migration Specialist at AWS Database Migration Accelerator. She has over 10 years of technical experience focusing on migrating and replicating databases and data warehouse workloads. She is passionate about helping customers on their cloud journey.