Skip to content

How do I change the Amazon VPC for an Amazon RDS DB instance?

3 minute read
1

I want to move my Amazon Relational Database Service (Amazon RDS) DB instance from an existing Amazon Virtual Private Cloud (Amazon VPC) to a new VPC.

Short description

To move an RDS DB instance to a new VPC, you must change its subnet group. First, configure the new VPC with the required security group inbound rules, subnet group, and route tables. Then, move the DB instance to the new network. When you change the VPC for a DB instance, the instance reboots.

Note: The DB instance isn't accessible during the move. Change the VPC during a planned change window that's outside of the Amazon RDS weekly maintenance window.

Before you change the VPC for a DB instance, review the following factors:

  • The DB instance must be a Single-AZ configuration. If your DB instance is in multiple Availability Zones, then convert the DB instance to a Single-AZ configuration. After you move the instance to the new VPC, convert the instance back to a Multi-AZ configuration.
    Note: You can't change a DB subnet group to a Multi-AZ configuration. By default, the Amazon Aurora storage is Multi-AZ even for a single instance. So, you can't modify the VPC for Aurora. For more information, see How can I change the VPC of an Amazon Aurora for MySQL or PostgreSQL cluster?
  • The DB instance is a read replica or has read replicas. Remove the read replicas, and then add read replicas after you move the DB instance to the new VPC.
  • The subnet group created in the target VPC doesn't have subnets from the Availability Zone where the source database is running. If the Availability Zones are different, then the operation fails.

Resolution

To move your DB instance to a different VPC, complete the following steps:

  1. Open the Amazon RDS console.
  2. In the navigation pane, choose Subnet groups.
  3. Choose Create DB subnet group.
  4. For Subnet group details, enter the subnet name, description, and select your VPC ID.
  5. For Add subnets, select the subnets that you need for the DB instance.
  6. Choose Create.
  7. In the navigation pane, choose Databases.
  8. Select the DB instance, and then choose Modify.
  9. From the Connectivity section, select the Subnet group associated with the new VPC. Then, choose the appropriate Security group for that VPC.
  10. Choose Continue, and then choose Apply immediately.
    Note: If you don't choose Apply immediately, then Amazon RDS modifies the VPC during the next maintenance window.
  11. Review the details on the Modify DB instance page, and then choose Modify DB instance.
    Note: This task can take several minutes to complete.
  12. To confirm that the subnet changed, select the instance, and then navigate to the configuration details page. Check that the status is Complete and shows that the subnet group updated.
    -or-
    In the navigation pane, choose Events. Confirm that the process moved the DB instance to the target VPC.

Related information

Working with a DB instance in a VPC

Subnets for your VPC