In the previous blogs , I have explained How you can

Migrate RDS instance from One region to another

Migrate RDS instance from One account to another

In this blog we will learn how we can migrate the RDS instance to another VPC.

Important Note:

  • If the DB instance is in the Multi-Az ,Then we cannot move it to another VPC.In this case, First we need to convert the DB instance to Single AZ and once the DB is moved to new VPC , Then convert it to Multi-AZ.
  • If the DB instance is replica or the DB instance has read replica , Then we cannot change the VPC of the DB instance. In this case , First we need to remove the read replica , Migrate to another VPC and then create read replica.

PreRequisites

  • A new VPC with the private subnets , You can refer this

Moving to New VPC

Login to RDS Console and then Choose Databases , select the database which you want to migrate.

Under Connection & Security , You can see the details of the RDS instances such as VPC , subnet group , security group etc.

Creating Subnet group

Before moving a RDS DB instance , First we need to create a subnet groups and add the subnets to it from the New VPC.

To create a subnet group , Select subnet group from the lest navigation pane.

RDS

Then click Create DB Subnet Group , Under Subnet group details

Provide a name for the subnet group.

and then choose the VPC.

RDS

Under Add subnets,

Choose the availability zones that has the subnets which you want to add within the subnet group.

RDS

Then select the subnets across the AZ’s and then click Create

Now we have the DB subnet group ready to migrate the RDS DB instance to this new VPC.

In the left pane , Choose Databases

Select the DB instance and then click modify

On the Modify DB instance page , Under Network & Security

Select the new subnet group and then choose the appropriate security group associated with that VPC.

RDS

Scroll down and then Choose Continue ,

You either apply the changes immediately or you can wait for the next scheduled maintenance window to apply those changes.

RDS

And then click Modify DB Instance.

Now If you check the status of the DB instance , It shows moving-to-vpc

Once the migration to new VPC is completed , The status of the DB instance should be Available.

Finally You can verify whether the RDS DB instance is properly migrated to the new VPC.

Conclusion

We have successfully migrated the RDS DB instance from One VPC to another.

Hope you find it helpful. Thanks for reading.

Check out my other articles.