BlogTutorialsHow to Back Up WordPress to S3 Storage: Complete Guide (2025)

How to Back Up WordPress to S3 Storage: Complete Guide (2025)

Adrian Silaghi
Adrian Silaghi
January 6, 2026
14 min read
5 views
#wordpress #backup #s3 #object storage #updraftplus #backwpup #wp-cli #woocommerce
How to Back Up WordPress to S3 Storage: Complete Guide (2025)

Your WordPress site represents countless hours of work—blog posts, product pages, customer data, and media files. A single server failure, hack, or accidental deletion could wipe it all out.

This guide shows you how to automatically back up WordPress to S3-compatible storage using UpdraftPlus (easiest), BackWPup (free alternative), and WP-CLI scripts (for developers).

Why Back Up WordPress to S3?

Feature Host Backups Plugin (Local) S3 Storage
Off-site Protection Varies No Yes
Host Goes Down Lost Lost Safe
Your Control Limited Full Full
Retention Policy Host decides Disk space limited Unlimited
Cost per 100GB Often included Server disk space ~€0.40/mo
Multi-site Support Varies Yes Yes

What Gets Backed Up

A complete WordPress backup includes:

  • Database: Posts, pages, comments, users, settings, WooCommerce orders
  • wp-content/uploads: Media library (images, videos, PDFs)
  • wp-content/plugins: All installed plugins
  • wp-content/themes: All themes including customizations
  • wp-config.php: Database credentials and settings
  • .htaccess: Rewrite rules and security settings

What You'll Need

  • WordPress 5.0+ with admin access
  • S3-compatible storage credentials:
    • Endpoint URL: s3.danubedata.com
    • Access Key ID
    • Secret Access Key
    • Bucket name

Method 1: UpdraftPlus (Recommended)

UpdraftPlus is the most popular WordPress backup plugin with 3+ million active installations. Note: S3-Compatible (Generic) storage requires UpdraftPlus Premium ($70/year for 2 sites). The free version only supports direct Amazon S3.

Step 1: Install UpdraftPlus

  1. Go to PluginsAdd New
  2. Search for "UpdraftPlus"
  3. Install and Activate

Step 2: Configure S3 Storage

  1. Go to SettingsUpdraftPlus Backups
  2. Click the Settings tab
  3. Under "Choose your remote storage", select S3-Compatible (Generic)
  4. Configure your S3 connection:
# UpdraftPlus S3-Compatible Configuration
S3 access key: YOUR_ACCESS_KEY_ID
S3 secret key: YOUR_SECRET_ACCESS_KEY

S3 location: your-bucket-name/wordpress-backups/sitename
(Format: bucket-name/path)

S3 end-point: s3.danubedata.com

# Leave these as default unless needed:
Use DNSBucketName: No (unchecked)
  1. Click Test S3 settings to verify connection

Step 3: Configure Backup Schedule

# Recommended schedule for most sites:
Files backup schedule: Weekly (retain 4 backups)
Database backup schedule: Daily (retain 14 backups)

# For high-traffic/ecommerce sites:
Files backup schedule: Daily (retain 7 backups)
Database backup schedule: Every 12 hours (retain 28 backups)

# For low-traffic blogs:
Files backup schedule: Weekly (retain 4 backups)
Database backup schedule: Weekly (retain 8 backups)

Step 4: Select What to Back Up

Under "Include in files backup":

# Essential (always include):
✓ Plugins
✓ Themes
✓ Uploads

# Recommended:
✓ Any other directories found inside wp-content

# Usually not needed (can slow backup):
✗ WordPress core (can reinstall)
✗ Database backup with files (separate schedule is better)

Step 5: Exclude Large/Unnecessary Files

Click "..." next to each category to add exclusions:

# Exclude from Uploads:
backup*
backups
cache
*.log

# Exclude from Plugins:
*.log
cache

# Exclude from Themes:
node_modules
.git

Step 6: Save and Run First Backup

  1. Click Save Changes
  2. Go to Backup / Restore tab
  3. Click Backup Now
  4. Check both "Include your database" and "Include your files"
  5. Click Backup Now
  6. Watch the progress bar complete

Step 7: Verify Backup in S3

After backup completes, verify files exist in your S3 bucket:

# You should see files like:
backup_2025-01-05-1200_Site_Name_abc123-db.gz
backup_2025-01-05-1200_Site_Name_abc123-plugins.zip
backup_2025-01-05-1200_Site_Name_abc123-themes.zip
backup_2025-01-05-1200_Site_Name_abc123-uploads.zip

Restoring from UpdraftPlus

  1. Go to SettingsUpdraftPlusBackup / Restore
  2. Click Rescan remote storage if backups don't appear
  3. Find the backup date you want
  4. Click Restore
  5. Select components to restore (Database, Plugins, Themes, Uploads)
  6. Click Restore and wait for completion

Method 2: BackWPup (Free Alternative)

BackWPup is a free plugin that supports S3-compatible storage with no premium required. This makes it an excellent choice for budget-conscious users who want to use DanubeData or other S3-compatible storage.

Step 1: Install BackWPup

  1. Go to PluginsAdd New
  2. Search for "BackWPup"
  3. Install and Activate

Step 2: Create Backup Job

  1. Go to BackWPupAdd new job
  2. Configure the General tab:
# General Tab
Job Name: Daily S3 Backup
Job Tasks:
  ✓ Database backup
  ✓ Files backup
  ✓ WordPress XML export
  ✓ Installed plugins list

Backup File Creation:
Archive name: backwpup_%Y-%m-%d_%H-%M-%S_%hash%
Archive format: Tar GZip

Step 3: Configure Schedule

# Schedule Tab
Start job: with WordPress cron
Scheduler type: basic
Scheduler: Daily at 3:00 AM

Step 4: Configure S3 Destination

  1. Go to To: S3 Service tab
  2. Select S3 Services in Job Destination
  3. Configure:
# S3 Service Configuration
S3 Service: S3 compatible (Others)

S3 Server URL: https://s3.danubedata.com
S3 Region: eu-central-1
Access Key: YOUR_ACCESS_KEY_ID
Secret Key: YOUR_SECRET_ACCESS_KEY

S3 Bucket: your-bucket-name
S3 Bucket folder: backwpup/sitename/

File Deletion: Keep 14 backups

Step 5: Configure Files to Backup

# Files Tab
Backup root folder: /var/www/html (your WordPress root)

Folders to backup:
  ✓ Backup wp-content folder
  ✓ Backup plugins
  ✓ Backup themes
  ✓ Backup uploads

Exclude:
  - *.log
  - /wp-content/cache/
  - /wp-content/backup*/
  - /wp-content/upgrade/

Step 6: Save and Test

  1. Click Save changes
  2. Click Run now to test
  3. Check BackWPupLogs for status

Method 3: WP-CLI + Rclone (Developers)

For developers who prefer command-line control, WP-CLI with rclone provides maximum flexibility.

Prerequisites

# Install WP-CLI
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp

# Install rclone
curl https://rclone.org/install.sh | sudo bash

# Configure rclone (see previous guides for full setup)
rclone config
# Configure remote named "danubedata"

Backup Script

Create /usr/local/bin/wp-backup.sh:

#!/bin/bash
# WordPress S3 Backup Script
# Usage: wp-backup.sh /path/to/wordpress

set -e

# Configuration
WP_PATH="${1:-/var/www/html}"
BACKUP_DIR="/tmp/wp-backup-$$"
BUCKET="your-bucket"
SITE_NAME=$(basename "$WP_PATH")
DATE=$(date +%Y-%m-%d_%H-%M)
RCLONE_REMOTE="danubedata"

# Validate WordPress installation
if [ ! -f "$WP_PATH/wp-config.php" ]; then
    echo "Error: WordPress not found at $WP_PATH"
    exit 1
fi

echo "=== WordPress Backup Started: $DATE ==="
echo "Site: $WP_PATH"

# Create backup directory
mkdir -p "$BACKUP_DIR"

# Export database
echo "Exporting database..."
wp db export "$BACKUP_DIR/database.sql" --path="$WP_PATH" --allow-root
gzip "$BACKUP_DIR/database.sql"
echo "Database exported: $(du -h "$BACKUP_DIR/database.sql.gz" | cut -f1)"

# Backup wp-content (excluding cache and large unnecessary folders)
echo "Backing up wp-content..."
tar -czf "$BACKUP_DIR/wp-content.tar.gz" 
    -C "$WP_PATH" 
    --exclude="wp-content/cache" 
    --exclude="wp-content/backup*" 
    --exclude="wp-content/upgrade" 
    --exclude="wp-content/uploads/backup*" 
    --exclude="wp-content/debug.log" 
    --exclude="*.log" 
    wp-content
echo "wp-content backed up: $(du -h "$BACKUP_DIR/wp-content.tar.gz" | cut -f1)"

# Backup wp-config.php
echo "Backing up wp-config.php..."
cp "$WP_PATH/wp-config.php" "$BACKUP_DIR/wp-config.php"

# Backup .htaccess if exists
if [ -f "$WP_PATH/.htaccess" ]; then
    cp "$WP_PATH/.htaccess" "$BACKUP_DIR/.htaccess"
fi

# Create manifest
echo "Creating manifest..."
cat > "$BACKUP_DIR/manifest.txt" << EOF
WordPress Backup Manifest
========================
Date: $DATE
Site Path: $WP_PATH
Site Name: $SITE_NAME
WordPress Version: $(wp core version --path="$WP_PATH" --allow-root)
PHP Version: $(php -v | head -n1)
Database Size: $(du -h "$BACKUP_DIR/database.sql.gz" | cut -f1)
Content Size: $(du -h "$BACKUP_DIR/wp-content.tar.gz" | cut -f1)

Plugins:
$(wp plugin list --path="$WP_PATH" --allow-root --format=table)

Themes:
$(wp theme list --path="$WP_PATH" --allow-root --format=table)
EOF

# Create final backup archive
echo "Creating final archive..."
BACKUP_FILE="$BACKUP_DIR/${SITE_NAME}_${DATE}.tar.gz"
tar -czf "$BACKUP_FILE" -C "$BACKUP_DIR" 
    database.sql.gz 
    wp-content.tar.gz 
    wp-config.php 
    .htaccess 2>/dev/null || true 
    manifest.txt

BACKUP_SIZE=$(du -h "$BACKUP_FILE" | cut -f1)
echo "Final backup size: $BACKUP_SIZE"

# Upload to S3
echo "Uploading to S3..."
rclone copy "$BACKUP_FILE" "$RCLONE_REMOTE:$BUCKET/wordpress/$SITE_NAME/" --progress

# Verify upload
echo "Verifying upload..."
if rclone ls "$RCLONE_REMOTE:$BUCKET/wordpress/$SITE_NAME/$(basename $BACKUP_FILE)" > /dev/null 2>&1; then
    echo "Upload verified successfully!"
else
    echo "ERROR: Upload verification failed!"
    exit 1
fi

# Cleanup local backup
echo "Cleaning up..."
rm -rf "$BACKUP_DIR"

# Delete old backups (keep last 14)
echo "Cleaning old backups..."
rclone delete "$RCLONE_REMOTE:$BUCKET/wordpress/$SITE_NAME/" --min-age 14d

echo "=== Backup Complete ==="
echo "Location: s3://$BUCKET/wordpress/$SITE_NAME/$(basename $BACKUP_FILE)"
echo "Size: $BACKUP_SIZE"

Make executable and test:

chmod +x /usr/local/bin/wp-backup.sh
wp-backup.sh /var/www/html

Schedule with Cron

# Edit crontab
crontab -e

# Add daily backup at 4 AM
0 4 * * * /usr/local/bin/wp-backup.sh /var/www/html >> /var/log/wp-backup.log 2>&1

# For multiple sites
0 4 * * * /usr/local/bin/wp-backup.sh /var/www/site1 >> /var/log/wp-backup-site1.log 2>&1
30 4 * * * /usr/local/bin/wp-backup.sh /var/www/site2 >> /var/log/wp-backup-site2.log 2>&1

Restore Script

Create /usr/local/bin/wp-restore.sh:

#!/bin/bash
# WordPress S3 Restore Script
# Usage: wp-restore.sh backup-file.tar.gz /path/to/wordpress

set -e

BACKUP_FILE="$1"
WP_PATH="${2:-/var/www/html}"
RESTORE_DIR="/tmp/wp-restore-$$"

if [ -z "$BACKUP_FILE" ]; then
    echo "Usage: wp-restore.sh backup-file.tar.gz [/path/to/wordpress]"
    exit 1
fi

echo "=== WordPress Restore Started ==="
echo "Backup: $BACKUP_FILE"
echo "Destination: $WP_PATH"

# Download from S3 if URL provided
if [[ "$BACKUP_FILE" == s3://* ]]; then
    echo "Downloading from S3..."
    LOCAL_FILE="/tmp/$(basename $BACKUP_FILE)"
    rclone copy "danubedata:${BACKUP_FILE#s3://}" /tmp/
    BACKUP_FILE="$LOCAL_FILE"
fi

# Create restore directory
mkdir -p "$RESTORE_DIR"

# Extract backup
echo "Extracting backup..."
tar -xzf "$BACKUP_FILE" -C "$RESTORE_DIR"

# Put site in maintenance mode
echo "Enabling maintenance mode..."
wp maintenance-mode activate --path="$WP_PATH" --allow-root 2>/dev/null || true

# Restore database
echo "Restoring database..."
gunzip -c "$RESTORE_DIR/database.sql.gz" | wp db import - --path="$WP_PATH" --allow-root

# Restore wp-content
echo "Restoring wp-content..."
rm -rf "$WP_PATH/wp-content"
tar -xzf "$RESTORE_DIR/wp-content.tar.gz" -C "$WP_PATH"

# Restore wp-config.php (backup current first)
if [ -f "$RESTORE_DIR/wp-config.php" ]; then
    cp "$WP_PATH/wp-config.php" "$WP_PATH/wp-config.php.bak"
    cp "$RESTORE_DIR/wp-config.php" "$WP_PATH/wp-config.php"
fi

# Fix permissions
echo "Fixing permissions..."
chown -R www-data:www-data "$WP_PATH"
find "$WP_PATH" -type d -exec chmod 755 {} ;
find "$WP_PATH" -type f -exec chmod 644 {} ;

# Flush cache
echo "Flushing caches..."
wp cache flush --path="$WP_PATH" --allow-root
wp rewrite flush --path="$WP_PATH" --allow-root

# Disable maintenance mode
echo "Disabling maintenance mode..."
wp maintenance-mode deactivate --path="$WP_PATH" --allow-root 2>/dev/null || true

# Cleanup
rm -rf "$RESTORE_DIR"

echo "=== Restore Complete ==="

Multi-Site WordPress Backup

For WordPress Multisite networks:

UpdraftPlus Premium

UpdraftPlus Premium includes Multisite support. Configure as above but ensure "Include any other directories" captures all subsites.

WP-CLI for Multisite

# Export all site databases
wp db export backup.sql --path=/var/www/html --allow-root

# Or export individual subsites
wp db export site1.sql --url=site1.example.com --path=/var/www/html
wp db export site2.sql --url=site2.example.com --path=/var/www/html

WooCommerce Considerations

For WooCommerce sites, take extra precautions:

More Frequent Database Backups

# Schedule database backup every 6 hours
# Orders, customers, and inventory change frequently
Database backup schedule: Every 6 hours (retain 28 backups)

Exclude WooCommerce Logs

# Add to exclusions:
wp-content/uploads/wc-logs/
wp-content/woocommerce_uploads/*.log

Backup Payment Gateway Settings

Ensure wp-config.php and options table are backed up - they contain payment gateway API keys.

Best Practices

1. Test Restores Regularly

A backup is worthless if you can't restore it. Test monthly on a staging site.

2. Keep Multiple Retention Periods

# Recommended retention:
Daily backups: Keep 14 days
Weekly backups: Keep 8 weeks
Monthly backups: Keep 12 months

3. Monitor Backup Status

Check backup logs weekly. Set up email notifications for failures.

4. Separate Database and Files

Database changes frequently, files don't. Back them up on different schedules.

5. Encrypt Sensitive Backups

Enable encryption in UpdraftPlus for sites with customer data.

Troubleshooting

Issue: "S3 Error: Access Denied"

# Solutions:
1. Verify Access Key and Secret Key
2. Check bucket policy allows your key
3. Ensure bucket exists
4. Try enabling "Use DNSBucketName: No"

Issue: Backup Times Out

# Solutions:
1. Increase PHP max_execution_time to 300
2. Split backup into separate jobs (DB, plugins, uploads)
3. Use WP-CLI for large sites
4. Exclude large folders (cache, logs)

Issue: Large Upload Size

# Solutions:
1. Exclude wp-content/cache/
2. Exclude unused themes
3. Optimize images before backup
4. Use separate media CDN (reduces uploads folder)

Pricing Comparison

Solution Plugin Cost Storage (50GB) Total/Year
UpdraftPlus + AWS S3 Free ~$14/yr $14/yr
UpdraftPlus + Dropbox Free $120/yr $120/yr
VaultPress/Jetpack $48/yr Included $48/yr
UpdraftPlus Premium + DanubeData $70/yr €48/yr (1TB!) ~€115/yr
BackWPup (Free) + DanubeData Free €48/yr (1TB!) €48/yr

Get Started

Protect your WordPress site with automated S3 backups:

  1. Create a DanubeData account
  2. Create a storage bucket for backups
  3. Generate access keys
  4. Install UpdraftPlus and configure S3
  5. Run your first backup!

👉 Create Your Backup Bucket - €3.99/month includes 1TB storage

Your WordPress site is too valuable to leave unprotected. Set up automated backups today.

Need help with WordPress backup? Contact our team—we run WordPress sites too and understand the challenges.

Share this article

Ready to Get Started?

Deploy your infrastructure in minutes with DanubeData's managed services.