You can only attach your Database Instance to one Private Network at a time.
How to connect a PostgreSQL and MySQL Database Instance to a Private Network
Private Networks allows you to enhance the security of your system’s architecture by isolating it from the internet.
When using Private Networks, your application connects directly to your Database nodes without going through a Load Balancer.
This improves performance by reducing the latency between your application and your database nodes. It also increases the security of your databases, as Instances in your Private Network can directly communicate with your Database Instance, without passing through the public internet.
You can create new Database Instances to attach to your Private Network, or attach existing ones.
Before you start
To complete the actions presented below, you must have:
- A Scaleway account logged into the console
- Owner status or IAM permissions allowing you to perform actions in the intended Organization
- A valid API key
- A PostgreSQL or MySQL Database Instance
How to attach a Database Instance to a Private Network
-
Click PostgreSQL and MySQL under Managed Databases on the side menu. A list of your Database Instances displays.
-
Click the database name or «See more Icon» > More info to access the Database Instance information page.
-
Scroll to the Network section.
NoteAlternatively, you can follow the next steps from the Private Networks tab. Click + Attach to a Private Network to open the configuration pop-up.
-
Click Attach Private Network next to Private endpoint. A pop-up appears.
-
Choose whether to:
- Select and attach an existing Private Network and select the network from the drop-down list.
Important
The Database Instance must be attached to a Private Network in the same region.
- Create and attach a new Private Network and enter the name of the network in the form.
Important
If you select this option, a Private Network with default settings will be created in the same region as your Database Instance. Do not use a TLD (e.g. dev, cloud) as a name, to avoid conflicts.
NoteYour private IP addresses are automatically allocated. They are managed via an IP Address Manager (IPAM). You can retrieve them on the Private Network tab of your Database Instance. To allocate IPs manually, you can use the Scaleway API and CLI, or Terraform.
- Select and attach an existing Private Network and select the network from the drop-down list.
-
Click Attach to Private Network to conclude.
Managed Databases for PostgreSQL and MySQL are currently not compatible with the Static NAT feature of Scaleway Public Gateways.
You can use Public Gateways in SSH bastion mode and perform port forwarding.
If you are using Scaleway Kubernetes Kapsule, you can use the scaleway-k8s-vpc GitHub project to connect a Database Instance to your pods using a Private Network.
Once your Kapsule node is connected to the Private Network you can directly reach the database by using the assigned service IP. There is no need to expose it through a Kubernetes resource like a service. The database is ready to use out of the box.
The scaleway-k8s-vpc
is not an officially supported by Scaleway.
How to detach a Database Instance from a Private Network
- Click PostgreSQL and MySQL under Managed Databases on the side menu. A list of your Database Instances displays.
- Click the database name or «See more Icon» > More info to access the Database Instance information page.
- Click the Private Networks tabs. The Private Network configuration displays.
- Click «Unlink Icon» next to the static IP that you want to unlink from your Database Instance.
- Click Detach resource to remove the Instance from your Private Network.
This action takes a few moments to complete. During this time, your Database Instance:
- remains available,
- goes into Configuring mode, and
- network configuration actions become unavailable