When spinning up a new server in SpinupWP, you’re presented with the option to install database server software (i.e., MySQL) on the server or provide the connection information for an existing, external database server.
Why Use an External Database?
One of the benefits of using cloud server providers like DigitalOcean and AWS is that they offer managed database servers, so it’s relatively easy to provision a standalone database server that will be maintained for you.
One reason you might want to separate your database from your web server is performance. If your web server is under strain with the database server installed locally, moving the database to a separate instance with its own dedicated resources (CPU, memory, disk space) will help free up resources on your web server. Once your database server is separate, you can scale up its resources without needing to scale up the web server’s resources.
Another good reason to have a dedicated database server separate from the web server is to make moving sites easier. Let’s say you want to move a site from one server to another. One of the biggest pains of this procedure is moving the database, but if the database is on its own server, it won’t need to be moved.
Finally, managed database providers offer a huge benefit: incremental backups. Both DigitalOcean and Amazon Lightsail will backup your database server as it changes, almost in real-time, and they allow you to create a new database server from the backup from any point in time in the last 7 days.
For a very detailed look at the benefits of managed databases, specifically DigitalOcean’s managed databases, check out this video:
It is important that your database server/cluster is in close physical proximity to the web servers that will be accessing it to keep latency low. We do not recommend running a database server in a different data center from your web server, even if it’s with the same provider.
For the best security, we recommend running your database server within a Virtual Private Cloud (VPC) where all the servers that will connect to your database reside. DigitalOcean, Amazon Lightsail, AWS, Google Cloud, and others offer VPCs but not all providers do.
To configure an external database, you will need to create the database via your chosen provider. You will also need the following details:
- Database hostname
- Database port
- Database username
- Database password
- Database name
You will get this information from your provider when you create the database server via the provider’s dashboard. See the following docs for step-by-step instructions:
- Setting Up a DigitalOcean Managed MySQL Database and Adding It to SpinupWP
- Setting Up an Amazon Lightsail Managed MySQL Database and Adding It to SpinupWP
Configure an External Database When Provisioning a Server
When provisioning a new web server, you can choose between installing a database on the web server or using an external database at the “Database Settings” step. Clicking Use External Database will give you an option to configure an external database.
You will then be able to enter your external database details.
Once you’ve added the external database, you can select it from the dropdown and continue to provision your server.
Manage External Databases
You can manage external databases via the Team Settings dashboard.
You can see a list of all external databases:
You can edit and delete existing external databases and add new ones:
Any external databases you add here will be available when provisioning new servers.
Assign an External Database to an Existing Server
Currently, external databases cannot be configured for existing servers. This is because moving the database from a local MySQL server to an external one could lead to unexpected issues and possible downtime, the same reasons we don’t recommend resizing or upgrading a server. If you want to configure an external database to an existing server, instead create a new server with an external database, and move your sites over to the new server.