Home/Blog/DevOps & Cloud
DevOps & Cloud⚡ Intermediate
8 min read
September 02, 2026

Automate Encrypted Cloud Server Backups to S3 with Rclone and Cron

Technical Blueprint & Architecture Summary
Target EnvironmentUbuntu 24.04 / Debian 12
Hardware Reqs1 vCPU • 1GB RAM • NVMe
Verification Status Production Tested
🔒
Marcus Sterling
Security Operations Director
#Backups#Rclone#S3 Storage#Disaster Recovery#Automation

The 3-2-1 Backup Rule

Every reliable cloud infrastructure relies on the **3-2-1 rule**:

  • **3** total copies of your data.
  • **2** different storage media types.
  • **1** copy stored entirely off-site.
  • Rclone is an open-source command-line tool that syncs files to over 40 cloud storage providers (AWS S3, Google Cloud, Cloudflare R2, Wasabi) with client-side zero-knowledge AES encryption.


    Step 1: Install & Configure Rclone

    bash terminal
    sudo apt install -y rclone
    rclone config

    Follow the interactive prompt to connect your S3 bucket credentials.


    Step 2: Automated Nightly Backup Script

    Create `/usr/local/bin/backup-system.sh`:

    bash terminal
    #!/bin/bash
    set -e
    
    DATE=$(date +%Y-%m-%d_%H%M%S)
    BACKUP_DIR="/tmp/backup_$DATE"
    mkdir -p "$BACKUP_DIR"
    
    # 1. Dump PostgreSQL / MySQL Database
    pg_dump -U postgres -d edutechz > "$BACKUP_DIR/database.sql"
    
    # 2. Archive App Code & Environment
    tar -czf "$BACKUP_DIR/app_configs.tar.gz" /etc/nginx /etc/systemd/system
    
    # 3. Encrypt and Upload to Remote S3 via Rclone
    rclone copy "$BACKUP_DIR" remote-s3:my-backup-bucket/$DATE
    
    # 4. Clean up local temporary files
    rm -rf "$BACKUP_DIR"

    Make it executable:

    bash terminal
    sudo chmod +x /usr/local/bin/backup-system.sh

    Step 3: Schedule Cron Execution

    Run `sudo crontab -e` and append:

    cron terminal
    # Run daily at 02:00 AM UTC
    0 2 * * * /usr/local/bin/backup-system.sh >> /var/log/backup.log 2>&1

    Deploy On Edutechz NVMe Cloud

    Need clean IP addresses, DDoS mitigation, and 10 Gbps uplinks to run your proxies, containers, or Windows servers? Deploy your instance in 60 seconds.

    Explore Cloud Plans

    Recommended Technical Guides

    Networking & Privacy

    How to Set Up a High-Performance MTProto Proxy on Ubuntu 24.04 LTS

    9 min read
    Windows RDP

    Step-by-Step Windows RDP Optimization for High-Latency Connections

    8 min read
    Cybersecurity

    Best Practices for Securing Linux Cloud Servers Against Brute-Force Attacks

    10 min read