AWS Database Blog

Moving a replication task to a different replication instance in AWS DMS

We’re excited to announce a new feature of AWS Database Migration Service (AWS DMS) that allows you to move a replication task from one replication instance to another. With this feature, you can stop a running migration, move the task to an instance with a newer AWS DMS version or different instance type, and resume the migration from where you left off. The state and properties of the migration captured through the replication task remain as they were before.

This post shows you how to stop a running migration, move the task to a different replication instance, and resume the migration from where it stopped.

Moving a task is applicable in the following use cases:

  • You’re using an instance of a certain instance type (for example, a general purpose T2 instance) and you want to switch to a different instance type (such as a compute-optimized C4 instance).
  • Your current instance is overloaded by many replication tasks, and you want to spilt the load across multiple instances.
  • Your instance is in storage full; moving tasks off that instance to a more powerful instance is an alternative to scaling storage or compute on that instance.
  • You want to use a newly released feature of AWS DMS, but don’t want to create a new task and restart the migration. In this case, you can spin up a replication instance with a new AWS DMS version that supports the feature, and move the existing task to that instance.

Keep in mind that moving a task from a replication instance with a higher engine version to an instance with a lower engine version or to the same replication instance is not possible.

You can use the AWS DMS console, the AWS Command Line Interface (AWS CLI), or the AWS SDK to perform the move operation. In this post, we focus on moving the tasks using the AWS CLI and the AWS DMS console.

Before running the move operation, let’s get familiar with some terms:

  • Replication task – The task you want to move to a different replication instance
  • Source replication instance – The replication instance on which the replication task resides
  • Target replication instance – The replication instance to which the replication task is moved

Replication tasks now have two new states:

  • Moving – The task is in the process of being moved to another replication instance. The replication is in this state until the move is complete. The only allowed operation on the replication task when it’s being moved is deleting the task.
  • Failed-Move – A replication task enters this state when the move fails for any reason, such as not having enough storage space on the target replication instance. A replication task can be started, modified, moved, or deleted when in this state.

Prerequisites

Before getting started, we recommend reviewing the user guide and reference docs for this API.

Moving a replication task with the AWS CLI

Before you complete these steps, store the replication task ARN and target replication instance ARN. The following are sample values:

replication_task_arn=arn:aws:dms:us-west-2:account-id:task:sanketh-task-resource-id

target_replication_instance_arn=arn:aws:dms:us-west-2:account-id:rep:sanketh-instance-resource-id

  1. Stop the replication task with the following API:

    aws dms stop-replication-task --replication-task-arn $replication_task_arn

  2. Run the following CLI command to move the stopped task to the target replication instance:

    aws dms move-replication-task –-replication-task-arn $replication_task_arn –-target-replication-instance-arn $target_replication_instance_arn

    The response of this API call is the replication task object.

  3. Retrieve the replication task and instance information using the describe-replication-tasks API:

    aws dms describe-replication-tasks --filters “Name=replication-task-arn,Values=$replication_task_arn” --query “ReplicationTasks[0].{ReplicationInstanceArn:ReplicationInstanceArn,ReplicationTaskArn:ReplicationTaskArn,Status:Status}”

    This should return a response like the following:

    {

    “ReplicationInstanceArn”: “arn:aws:dms:us-west-2:account-id:rep:Sanketh-instance-resource-id”,

    “ReplicationTaskArn”: “arn:aws:dms:us-west-2:account-id:task:Sanketh-task-resource-id”,

    “Status”: “moving”

    }

    The target replication task status changes to Stopped when the move is complete.

  4. Resume the replication task or restart it with the following CLI command:

    aws dms start-replication-task --replication-task-arn $replication_task_arn –start-replication-start-type resume-processing

Moving a replication task via the AWS DMS console

To use the AWS DMS console to transfer your replication task to another instance, complete the following steps:

  1. After the replication task is stopped, from the Database migration tasks dashboard view, select the task that you want to move.
  2. From the Actions drop-down menu, choose Move.

  1. For Replication instance, choose the new instance to host the task.

  1. Choose Move database migration task.

The status of the task should change to Moving.

When the move is complete, the status changes back to its earlier status (in the following screenshot, it changes to Stopped).

You can verify the task is moved to the target replication instance on the Overview details tab.

You can restart or resume the replication task just like a regular replication task. Your replication task will have the same properties and state, and you can choose how to use this resource.

Summary

The MoveReplicationTask feature allows you to easily and quickly transfer your running migration to a better, more suited, or more powerful replication instance. You can move your replication tasks across instance types or AWS DMS versions. You can quickly and safely move your replication tasks to an instance running the latest AWS DMS version and use newer features available on the instance.

For more information about this feature and our service, see our documentation. Feel free to innovate and use this feature to suit your business needs. Happy migrating!


About the Authors

Sanketh Balakrishna is a Software Development Engineer with the Database Migration Service team at Amazon Web Services. He works on the design and development of customer requested features, and contributes to improving the overall security of DMS. He is the lead developer for the move replication task project.

 

 

 

Viqash Adwani is a Database Engineer with Database Migration Service team at Amazon Web Services. He works with internal and external customers to provide guidance and technical assistance in migrating their on-premises database environment to AWS cloud, helping them improve the value of their solutions when using AWS.