Wondering how to change the VPC for an Amazon RDS DB instance? We can help you!
As a part of our AWS Support Services, we often receive similar queries from our AWS customers.
Today, let’s see the steps followed by our Support Engineers to move the Amazon RDS DB instance from an Amazon VPC to a new VPC.
Change the VPC for an Amazon RDS DB instance
Moving the Amazon RDS DB instance to a new VPC requires a reboot of the instance because the DB instance moves from one network to another. So the proper network configurations such as subnet group, security group inbound rules, and Route tables should be done on the new VPC before moving the DB instance to the new VPC. Also, note that we must change the RDS DB instance’s subnet group to move it to the new VPC.
Steps to move Amazon RDS DB instance to a new VPC
Now, let’s see the steps followed by our Support Techs to change the VPC for an RDS DB instance.
- At first, log into the AWS Management Console and open the Amazon RDS console.
2. Select Subnet Groups and then select Create DB Subnet Group.
3. Then enter the details such as subnet name, description, and VPC ID.
4. Also, select the subnets required for the RDS DB instance and then click Create.
5. Select Databases and choose the DB instance and then click Modify.
6. Select the Subnet Group related to the new VPC under the section Network Security and then select the appropriate Subnet Group.
7. Click Continue and then select Apply Immediately.
8. Finally, review the details on the Modify DB Instance page, and then click Modify DB Instance.
This task may take some minutes to complete. To confirm that the task moved the DB instance to the new VPC by selecting the Events section in the Amazon RDS console.
Make sure to change the VPC during a planned change window outside the RDS weekly maintenance window as the DB instance is not accessible while moving to the new VPC.
Now, let’s discuss the cases for which we can’t change the VPC for an RDS DB instance:
- We are unable to change the VPC for an RDS DB instance if it is in multiple Availability Zones. So we need to convert the RDS DB instance to a single Availability Zone. And move the instance to the new VPC and, then we can convert it back to a Multiple Availablity zone.
- If the RDS DB instance is a read replica or it has read replicas then we can’t change the VPC. So we need to remove the read replicas and we can add back read replicas after moving the DB instance.
- If the Availability Zones for existing and new VPCare different, the operation fails. The subnet group created in the new VPC must have subnets from the Availability Zone where the source database is running.
[Need help with more AWS queries? We’d be happy to assist]
To conclude, today we saw the steps followed by our Support Engineers to change the VPC for an Amazon RDS DB instance.