Automate PostgreSQL database backup directly to your DigitalOcean Spaces.
In this article, we will find out how to configure your PostgreSQL backup and store it on DigitalOcean Spaces.
Prerequisites
-
Create a SimpleBackups account
-
Make sure you have your server connected to your account (the one on which your PostgreSQL database is hosted)
-
Have a DigitalOcean account (we'll cover how to create your DigitalOcean Space below)
1. Create your DigitalOcean Spaces
-
Create a new "Spaces" using the create menu at the top right

-
Fill in the "Create Spaces" form
-
Pick the region you need (think about GDPR rules, if you're an EU company)
-
Select "Restrict File Listing"
-
Pick a name you like and link it to your DigitalOcean project (doesn't really affect us)
That's it! Your DigitalOcean Spaces is now created.

Don't leave the DigitalOcean interface, we'll now have to create your credentials.
Information you'll need in step 3:
- Your "Spaces" name, in this case "myacme-space"
- Your "Spaces" Region, in this case "San Francisco 2", which you can also see in your DO Space url
2. Create your DigitalOcean Credentials
Creating the Space was the long part. The credentials are quicker.
We've covered the steps in how to create DigitalOcean Spaces credentials. Note that a Spaces key is not the same thing as a DigitalOcean personal access token: only the Spaces key pair works here.
Information you'll need in step 3:
- Key
- Secret
3. Connect your Space to SimpleBackups
- Log into SimpleBackups and head to the connect your storage page
- Pick "DigitalOcean Spaces" as storage provider and fill in the "Connect your storage" form with the information from step 1 and 2.

You'll have to input :
- Key: Key described in (step 2)
- Secret: Secret described in (step 2)
- Region: Spaces region described in (step 1)
- Bucket: Spaces name described in (step 1)
- Give your storage a name (usually we like to use the Spaces name) and click on "Save new storage".
You'll be redirected to the list of storage where you'll find your newly connected storage.

4. Final step: Create your PostgreSQL backup
Now it's time to head to the create backup page.
From this screen you'll be able to configure what data you're backing up (PostgreSQL in this case), where you want it to be saved (in this case your DigitalOcean Bucket), and how often you want this to be done.
FYI this section will be the same, no matter what storage you pick. And that's the beauty of it, if you want to change storage, just select another one from the list (DigitalOcean, AWS, or whatever you might prefer) and you'll be good to go.

What would you like to back up? (A)
- Select "Database" (in this article we're creating a PostgreSQL backup only)
- Select the server on which your database is hosted
How often should we make this backup? (B)
-
Select your schedule option (here we picked a daily schedule)
You can select a pre-defined schedule (daily, weekly, monthly) or a custom option allowing you to schedule it whenever you want to use CRON syntax.
-
Example of CRON schedule for "20:00 every Tuesday" =
0 22 * * 2Finally, the "On demand" option won't schedule anything but will allow you to trigger the backup manually or using our API.
-
Define the backup retention, which is the number of backups you want to keep (kind of the history length of your backup if you prefer)
Choose the database you need to backup (C)
- Select the type of your database, in this case "PostgreSQL"
- Fill in the database connection form
Finalize and create (D)
- Pick the name of your backup (this is how it will be displayed in SimpleBackups interface) and where you want to store it.
- Select your Storage (step 3)
Congratulations, you now have your PostgreSQL database, backed up on DigitalOcean Spaces.
Run it once manually (using the "Run" backup button from the backups list) and you'll trigger your first backup!
FAQ
Which DigitalOcean credentials does SimpleBackups need for Spaces?
A Spaces access key and secret, generated under API, Spaces Keys in the DigitalOcean control panel. These are separate from your DigitalOcean personal access token, which does not work for Spaces.
Where do I find my Spaces region?
The region is the first segment of the Space endpoint, for example sfo2 in sfo2.digitaloceanspaces.com. It is visible on the Space settings page and in the Space URL.
Does storing backups in DigitalOcean Spaces count as off-site?
Only if the database is not also on DigitalOcean. Backups in the same provider account as production do not survive account suspension or a provider-level problem, so pick a Space in a different provider or region than the database when that matters.
How do I restore a PostgreSQL backup stored in Spaces?
Download the dump from the Space, then restore it with psql for a plain SQL file or pg_restore for a custom-format archive. The restore guide covers both paths and the errors that come up most often.
Keep learning
- The ultimate PostgreSQL backup script, if you would rather own the
pg_dumpand upload pipeline yourself. - pg_dump and pg_restore guide, for the dump options behind whichever route you pick.
- How to restore a PostgreSQL backup, because a backup you have never restored is an assumption.
Scheduling, retention and restores across every destination are covered on the managed PostgreSQL backup page.
This article is part of The complete guide to PostgreSQL backup, an honest, practical reference from the team that backs up PostgreSQL every day.