---
title: "Deploy PostgreSQL & S3 Backup"
description: "PostgreSQL database with a CRON job that uploads a backup to S3"
category: "Storage"
url: https://railway.com/deploy/XV2dlg
---

# Deploy PostgreSQL & S3 Backup

PostgreSQL database with a CRON job that uploads a backup to S3

**[Deploy PostgreSQL & S3 Backup on Railway](https://railway.com/template/XV2dlg)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/XV2dlg/manifest.json

- **Creator:** Yannick's Projects
- **Category:** Storage
- **Total deploys:** 15

## Template content

### S3 Backup

- **Image:** eeshugerman/postgres-backup-s3:16

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:latest

## Documentation

# PostgreSQL & S3 Backup

This template contains a PostgreSQL database and a CRON job that automatically creates a backup and uploads it to S3.

## What you need

- AWS Account with Access Key
- S3 Bucket

## Variables

| Name                 | Description                                                                                                                                                                                                                | Optional | Default value |
|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|---------------|
| SCHEDULE             | CRON schedule at which the backup is run. The schedule also supports non standard values like @hourly, @daily, @weekly, @monthly and @yearly. If left empty the backup will be run immediately and the container will stop | Yes      |               |
| BACKUP_KEEP_DAYS     | The number of days to keep a backup file for. If left empty backups will NEVER be automatically deleted                                                                                                                    | Yes      |               |
| Passphrase           | Passphrase to be used when encrypting the backup using GPG. If left empty NO encryption will be done                                                                                                                       | Yes      |               |
| S3_REGION            | The region the AWS S3 bucket was created in                                                                                                                                                                                | No       |               |
| S3_BUCKET            | The name of the bucket to upload your files into                                                                                                                                                                           | No       |               |
| S3_ACCESS_KEY        | The ID of the your access key used to upload files into the S3 bucket                                                                                                                                                      | No       |               |
| S3_SECRET_ACCESS_KEY | The secret key of your AWS access key                                                                                                                                                                                      | No       |               |
| S3_PREFIX            | The prefix to be used when uploading the backup to S3. If left empty the backup will be uploaded to the root of the bucket                                                                                                 | No       | backup        |

## Similar templates

- [Garage S3 Storage](https://railway.com/deploy/garage-s3-storage) — Ultra-light S3 server: fast, open-source, plug-and-play.
- [Redis](https://railway.com/deploy/redis-1) — Self Host Latest Redis with Railway
- [EasyImg](https://railway.com/deploy/easyimg) — Simple self-hostable Nuxt.js personal image hosting system.

Open this page in a browser: https://railway.com/deploy/XV2dlg
