Joy
Joy

Reputation: 4511

Migrating data from live RDS database instance associated with one AWS account to a new RDS database instance associated with another AWS account

I am working with a Sprint boot application hosted on AWS. Application data gets stored in AWS RDS. Now I have set up another AWS account where I would like to migrate the data from the RDS instance associated with the current AWS account.

In this regard, after going through several posts here, it seems, the steps to do the same are as follows:

1. Create a snapshot of the database in the RDS database instance associated with the current AWS account.
2. Share the snapshot with the new AWS account.
3. Import the data from this snapshot to the RDS instance associated with the new AWS account.

One problem with this approach is: I have to make the application unavailable to the end-users until all the steps are completed as well as the application with the database hosted in the new AWS account starts running, otherwise there will be always some delta remaining to be migrated.

But, I would like to migrate the data from an existing instance to the new instance without making the application unavailable to end-users, I did not find any suitable approach to achieve the same.

Could anyone please help here? Thanks.

Upvotes: 1

Views: 1608

Answers (2)

asktomsk
asktomsk

Reputation: 2298

Good article on how to setup cross-account replication: https://aws.amazon.com/premiumsupport/knowledge-center/rds-mysql-cross-region-replica/

Another way is using AWS Database Migration Services (AWS DMS).

You can create a migration task, and set the original database as the source endpoint, and the new database as a destination endpoint.

Next create a task with "Full load, ongoing replication" settings.

Some caveats: make sure to enable replication on the source database and it uses RAW bin log format for MySQL/MariaDB. More details here: https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.MySQL.html It also damaged the destination tables structure in my case.

Upvotes: 0

Abhijith Gm
Abhijith Gm

Reputation: 71

create a read replica

stop slave in read replica using stop MySQL.rds_stop_replication

capture mysql_binary_log_file_name,mysql_binary_log_file_location

stop instance

take snapshot

restore in another AWS account

create replication user name in master

run below command in newly created RDS with required values

CALL mysql.rds_set_external_master ( host_name , host_port , replication_user_name , replication_user_password , mysql_binary_log_file_name , mysql_binary_log_file_location

);

move connection and plan cut over properly

Upvotes: 0

Related Questions