Back up Supabase to Google Drive
Google Drive is not S3-compatible storage. It has its own OAuth-based API, so most database backup tools cannot write to it. BackupDrill’s hosted service can: connect your Google account, and scheduled database backups go into a BackupDrill folder in your Drive, with restore drills that check the latest one restores. If you would rather run every part yourself, the DIY workflow (pg_dump, rclone and GitHub Actions, with complete commands below) also puts a dump in Drive on a schedule. This guide covers both, then the signs that a bucket is a better place for your backups.
Path A — hosted: BackupDrill
Sign up, connect your Supabase project, and on the next step choose Google Drive. A Google window asks you to allow access. BackupDrill asks for one permission, which lets it see only the files it creates, never the rest of your Drive. There is no OAuth client to create and no consent screen of your own to publish, so none of the DIY steps below apply.
Backups then run on your plan’s schedule (weekly on Free, daily on Solo, and up to every 12 hours on Team and Agency) into a BackupDrill folder with one folder per project. Each backup holds the database dump, a manifest with checksums, and a RECOVERY.md with the exact restore steps, so you can restore from the folder with standard Postgres tools even without us. Your Auth users go into the same folder too, unless you turn that off in the project’s settings or the database role can’t read them. Backups past your plan’s retention go to your Drive’s trash. Restore drills download the latest backup, restore it into a throwaway Postgres, and check it: daily on paid plans, once on Free. If a backup or a drill fails, you get an email.
Two limits to know before you start. Drive backups cover the database only; Storage files need an S3-compatible bucket. And one database dump on Drive can be up to 10 GB, or your plan’s size limit if that is lower. The free plan covers one project: sign up at app.backupdrill.com. Supabackup is another hosted service that writes dumps to Drive, for less money and without Storage files or restore testing; Supabackup vs BackupDrill compares the two.
Path B — DIY: pg_dump + rclone + GitHub Actions
rclone is an open-source tool that talks to Google Drive’s API and copies files much like cp does. You need a Google OAuth client, an rclone remote, and a scheduled workflow.
B1 — create your own Google OAuth client
rclone ships with a default client ID, but every rclone user shares it, so it is heavily rate-limited. rclone’s own docs strongly recommend creating your own. In the Google Cloud Console: create a project, enable the Google Drive API, configure the OAuth consent screen, and create an OAuth client ID of type Desktop app. Then publish the consent screen to production. This step is easy to skip. If the app stays in Testing mode, its grants expire after about a week, and your scheduled backup stops authenticating without any obvious error. Publishing does not require Google’s verification process for a personal-use client.
B2 — configure the rclone remote
rclone config
# n) New remote
# name> gdrive
# Storage> drive
# client_id> <your OAuth client ID — see the note above>
# client_secret> <its secret>
# scope> 3 (drive.file — rclone can only touch files it created)
# service_account_file> (leave blank)
# Edit advanced config? n
# Use web browser to automatically authenticate? y
# → browser opens, approve access, rclone saves the token
# to ~/.config/rclone/rclone.confThe drive.file scope is the least-privilege choice: rclone can create, read, and delete only the files it created, so a leaked token cannot read the rest of your Drive. The browser step is a one-time interactive authentication; the resulting refresh token in ~/.config/rclone/rclone.conf is what the scheduled job will reuse.
B3 — dump and upload
# Session pooler string — Connect button at the top of the Supabase dashboard
export DB_URL="postgresql://postgres.<project-ref>:<password>@aws-0-<region>.pooler.supabase.com:5432/postgres"
pg_dump "$DB_URL" \
--format=custom \
--schema=public \
--file="backup-$(date +%F).dump"
rclone copy "backup-$(date +%F).dump" gdrive:supabase-backups/The connection string is the Session Pooler URI from the Connect button at the top of the Supabase dashboard (the Direct connection string runs over IPv6 unless the project has the IPv4 add-on, so on an IPv4-only network use the Session Pooler), and your pg_dump major version must be ≥ your project’s Postgres version. Supabase runs PG 15 or 17. --schema=public captures your application schema only; Supabase-managed schemas (auth, storage) are not included, and neither are your Storage files. A database dump never contains them, wherever you store it.
B4 — schedule it with GitHub Actions
Paste the full contents of your working rclone.conf into a repository secret named RCLONE_CONF, add your pooler string as SUPABASE_DB_URL, and commit this workflow to a private repository (GitHub disables scheduled workflows in public repositories after 60 days without activity):
# .github/workflows/backup-to-drive.yml
name: backup-to-drive
on:
schedule:
- cron: "0 3 * * 0" # weekly, Sunday 03:00 UTC
workflow_dispatch: {} # lets you trigger a backup by hand
permissions:
contents: read
# Never let two backups overlap.
concurrency:
group: backup-to-drive
cancel-in-progress: false
jobs:
backup:
runs-on: ubuntu-latest
steps:
# pg_dump's major version must be >= your Supabase Postgres version.
# Supabase projects run PG 15 or 17 — postgresql-client-17 covers both.
- name: Install postgresql-client-17 (PGDG)
run: |
sudo install -d /usr/share/postgresql-common/pgdg
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
| sudo gpg --dearmor -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg
echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg] \
https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" \
| sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt-get update
sudo apt-get install -y postgresql-client-17
- name: Install rclone
run: curl -fsSL https://rclone.org/install.sh | sudo bash
# RCLONE_CONF secret = the full contents of your working local
# ~/.config/rclone/rclone.conf ([gdrive] section included). Injected
# via env so the quotes in the token JSON can't break shell quoting.
- name: Write rclone config
env:
RCLONE_CONF: ${{ secrets.RCLONE_CONF }}
run: |
mkdir -p ~/.config/rclone
printf '%s' "$RCLONE_CONF" > ~/.config/rclone/rclone.conf
- name: Dump the database
env:
DB_URL: ${{ secrets.SUPABASE_DB_URL }}
run: |
/usr/lib/postgresql/17/bin/pg_dump "$DB_URL" \
--format=custom \
--schema=public \
--file="backup-$(date +%F).dump"
- name: Upload to Google Drive
run: rclone copy "backup-$(date +%F).dump" gdrive:supabase-backups/
# Drive has no bucket-style lifecycle rules — prune inside the job.
# rclone moves deletions to Drive's trash by default.
- name: Prune dumps older than 90 days
run: rclone delete --min-age 90d gdrive:supabase-backups/Every run also pulls the whole database out of Supabase, which counts against your plan’s egress allowance (5 GB/month on the Free plan). That is why weekly is a sensible frequency; the GitHub Actions guide explains the reasoning in detail.
When a bucket is the better home
Drive is a fine place to start. As a project grows, four things push database backups toward object storage:
- Storage files. A database dump never contains your users’ uploads. BackupDrill backs up Storage files only to an S3-compatible bucket, where they land in the same snapshot as the database and the drill checks a sample of them.
- Room to grow. A personal Google account’s 15 GB is shared with Gmail and Photos, and several kept dumps plus 30 days of trash add up quickly. A bucket grows with the data and bills per gigabyte.
- Machine credentials. A bucket key is a scoped machine credential you can rotate, restrict to one bucket, and hand to CI. A Drive connection is an OAuth grant on one person’s Google account, and it stops working when that person revokes it or the account goes away.
- Egress costs. Cloudflare R2 charges zero egress, so downloading every byte for a real recovery or a drill is free. Backblaze B2 gives you free egress up to 3x what you store. That matters for backups, because a restore reads the whole thing back.
When you are ready for that move, the destination guides have the complete click-paths: Cloudflare R2 (zero egress), AWS S3 (if your infrastructure already lives there), and Backblaze B2 (cheapest storage). The shorter bucket setup docs cover all three.
FAQ
Can BackupDrill back up Supabase to Google Drive?
Yes, the hosted service can. In the console, choose Google Drive as the destination and connect your Google account: there are no keys to create, and BackupDrill can only see the files it creates in your Drive. Drive backups cover the database; Storage files need an S3-compatible bucket. Every plan can use it, including Free, for database dumps up to 10 GB, or your plan's size limit if that is lower. The open-source backupdrill CLI writes to S3-compatible storage only.
Why does my rclone Google Drive upload stop working after about a week?
Usually it's the OAuth consent screen. If the Google Cloud app behind your rclone client ID is still in Testing mode, Google expires its grants after about a week, and rclone's stored refresh token stops working with them. Publish the OAuth consent screen to production (verification is only required past 100 users), then reconnect the remote once. The new token won't expire after a week.
Is Google Drive a good place for database backups?
For a small project, often yes: a backup in a Drive folder you can open is far better than none, and the 15 GB a personal Google account includes (shared across Gmail, Drive, and Photos) fits many databases. The trade-offs grow with the data: the connection is one person's Google account rather than a scoped machine key, a free Drive fills up once you keep several large dumps plus 30 days of trash, Storage files cannot go there with BackupDrill, and a DIY setup leaves pruning and restore testing to you. Past a few gigabytes, or once users upload files, a bucket you own is the better home. Wherever the backups live, make sure something tests that they restore.
Sources
- rclone docs — Google Drive
- Google Identity docs — Using OAuth 2.0
- Supabase docs — Connecting to your database
- Supabase docs — Manage Egress usage
- PostgreSQL docs — pg_dump
- GitHub Docs — Events that trigger workflows
- Supabackup — homepage and pricing
- Cloudflare R2 docs — Pricing
Facts and prices last verified July 11, 2026 against the sources above. Written by the team behind BackupDrill.