Uploads backups to a Google Drive folder using google-api-python-client with service account authentication.
Module: backups.destinations.gdrive
{
"id": "gdrive-backup",
"type": "gdrive",
"creds_file": "/etc/backups/gdrive-service-account.json",
"folder_id": "YOUR_GOOGLE_DRIVE_FOLDER_ID",
"retention_copies": 10,
"retention_days": 90
}- Go to the Google Cloud Console and create (or select) a project.
- Enable the Google Drive API for the project.
- Create a service account and download the JSON key file.
- Place the key file on the backup host (e.g.
/etc/backups/gdrive-service-account.json, mode0400). - In Google Drive, create a folder for backups, then share it with the service account email address (grant Editor permission).
- Copy the folder ID from the Drive URL (the long string after
/folders/).
| Key | Required | Purpose |
|---|---|---|
id |
Yes | Unique identifier for this destination. |
creds_file |
Yes | Path to the service account JSON key file. |
folder_id |
Yes | Google Drive folder ID to store backups in. |
retention_copies |
No | Number of most recent timestamped sub-folders to keep. |
retention_days |
No | Delete backup folders older than this many days. |
{folder_id}/
{source_id}/
{timestamp}/
{filename}