---
title: "Deploy mysql-s3-backups"
description: "Backup your MySQL or MariaDB database to S3 via a cron."
category: "Automation"
url: https://railway.com/deploy/BZJOmR
---

# Deploy mysql-s3-backups

Backup your MySQL or MariaDB database to S3 via a cron.

**[Deploy mysql-s3-backups on Railway](https://railway.com/template/BZJOmR)**

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

- **Creator:** Ad Astra Labs
- **Category:** Automation
- **Total deploys:** 5

## Template content

### mysql-s3-backups

- **Source:** PenguinOfWar/mysql-s3-backups

## Documentation

## Overview

The template uses node-cron or Railway cron, written in TypeScript to dump your MySQL or MariaDB data to a file and then upload the file to S3.

## Highlights

- Configurable backup schedule: By default, the cron runs at 5 AM every day but is configurable via the BACKUP_CRON_SCHEDULE environment variable.

- Support for custom buckets: The script also supports using a AWS_S3_ENDPOINT environment variable to use any S3 compliant storage bucket (eg: Wasabi).

## Configuration

- `AWS_ACCESS_KEY_ID` - AWS access key ID.

- `AWS_SECRET_ACCESS_KEY` - AWS secret access key, sometimes also called an application key.

- `AWS_S3_BUCKET` - The name of the bucket that the access key ID and secret access key are authorized to access.

- `AWS_S3_REGION` - The name of the region your bucket is located in, set to `auto` if unknown.

- `BACKUP_DATABASE_HOST` - The host of the database to backup.

- `BACKUP_DATABASE_PORT` - The port of the database to backup.

- `BACKUP_DATABASE_NAME` - The name of the database to backup.

- `BACKUP_DATABASE_USERNAME` - The username of the database to backup.

- `BACKUP_DATABASE_PASSWORD` - The password of the database to backup.

- `BACKUP_CRON_SCHEDULE` - The cron schedule to run the backup on. Example: `0 5 * * *`

- `AWS_S3_ENDPOINT` - The S3 custom endpoint you want to use. Applicable for 3-rd party S3 services such as Cloudflare R2 or Backblaze R2.

- `AWS_S3_FORCE_PATH_STYLE` - Use path style for the endpoint instead of the default subdomain style, useful for MinIO. Default `false`

- `RUN_ON_STARTUP` - Run a backup on startup of this application then proceed with making backups on the set schedule.

- `BACKUP_FILE_PREFIX` - Add a prefix to the file name.

- `BUCKET_SUBFOLDER` - Define a subfolder to place the backup files in.

- `SINGLE_SHOT_MODE` - Run a single backup on start and exit when completed. Useful with the platform's native CRON schedular.

- `SUPPORT_OBJECT_LOCK` - Enables support for buckets with object lock by providing an MD5 hash with the backup file.


## Similar templates

- [N8N Main + Worker](https://railway.com/deploy/n8n-main-worker) — Deploy and Host N8N with Inactive worker.
- [Evolution API with n8n](https://railway.com/deploy/evolution-api-with-n8n) — Automate WhatsApp workflows with Evolution API, n8n, and Postgres.
- [Postgres Backup](https://railway.com/deploy/postgres-s3-backups) — Cron-based PostgreSQL backup to bucket storage

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