--- title: "Attach a VPC to a DBaaS instance" description: "Attach up to three VPCs to a MySQL, MariaDB, or PostgreSQL DBaaS instance so resources inside them reach it privately." content_type: "how-to" product: "database" platform: "MyAccount" url: "/myaccount/database/how-to/attach-a-vpc-to-a-database/" topic: ["security-and-access"] relationships: {"requires":["/myaccount/vpc/"]} --- # Attach a VPC to a DBaaS instance Attach a VPC to a DBaaS instance so that anything inside the VPC can reach it on its private address. You can attach up to three VPCs to one DBaaS instance. ## Before you begin You need a DBaaS instance that reads **Running**, and your application's nodes in a VPC; see [VPC](/myaccount/vpc/). ## Attach a VPC 1. On the DBaaS instance's **Network** tab, click **Add VPC**. 2. In **Attach VPC**, choose the **VPC** your application's nodes are in. 3. (Optional) Choose a subnet in **Select Subnet (Optional)**. 4. Click **Attach**. Anything inside that VPC can now reach the DBaaS instance on its **Private IPv4**. If the whitelist has any IPs on it, add the VPC's range (its CIDR) to the whitelist too; the whitelist applies to connections over the VPC as well. See [Whitelist an IP address](/myaccount/database/how-to/whitelist-an-ip-address/) and [Connect to a DBaaS instance](/myaccount/database/how-to/connect-to-a-database/). ## Detach a VPC If a Read Replica in the other region syncs through this VPC, detaching the VPC pauses that sync until you reattach the VPC; see [Create a Read Replica](/myaccount/database/how-to/create-a-read-replica/). 1. On the DBaaS instance's **Network** tab, open the VPC's row menu and click **Detach**. 2. In **Detach VPC**, click **Detach**. The DBaaS instance stays reachable on its **Private IPv4** from the VPCs still attached to it. To connect from one of them, see [Connect to a DBaaS instance](/myaccount/database/how-to/connect-to-a-database/).