Hostxpeed
Login Get Started →
Control Panel

How to Set Up S3 Backup in HestiaCP

6 min read
23 views
Jun 10, 2026

Prerequisites

Before setting up S3 backups, make sure you have:

  • AWS S3 bucket (or compatible storage like Wasabi, DigitalOcean Spaces)
  • Access Key ID and Secret Access Key
  • Bucket name and region

Install AWS CLI

apt update
apt install awscli -y

Configure AWS credentials:

aws configure

Enter:

  • AWS Access Key ID
  • AWS Secret Access Key
  • Default region (e.g., us-east-1)
  • Output format (json)

S3 Backup Script

#!/bin/bash
BUCKET="your-bucket-name"
BACKUP_FILE="/backup/admin.$(date +%Y%m%d).tar"

# Create backup
/usr/local/hestia/bin/v-backup-users

# Upload to S3
aws s3 cp $BACKUP_FILE s3://$BUCKET/hestia-backups/

# Delete local backups older than 7 days
find /backup -name "*.tar" -mtime +7 -delete

# Delete S3 backups older than 30 days
aws s3 ls s3://$BUCKET/hestia-backups/ | while read -r line; do
    createDate=$(echo $line|awk '{print $1" "$2}')
    createDate=$(date -d "$createDate" +%s)
    olderThan=$(date -d "-30 days" +%s)
    if [[ $createDate -lt $olderThan ]]; then
        fileName=$(echo $line|awk '{print $4}')
        if [[ $fileName != "" ]]; then
            aws s3 rm s3://$BUCKET/hestia-backups/$fileName
        fi
    fi
done

For S3-Compatible Storage (Wasabi, DigitalOcean, etc.)

Configure endpoint:

aws configure set default.s3.endpoint https://nyc3.digitaloceanspaces.com

For Wasabi:

aws configure set default.s3.endpoint https://s3.wasabisys.com

Schedule S3 Backup in Cron

crontab -e

Add:

0 2 * * * /root/s3-backup.sh

Restore from S3

aws s3 cp s3://your-bucket-name/hestia-backups/admin.2026-04-29.tar /backup/
/usr/local/hestia/bin/v-restore-user admin /backup/admin.2026-04-29.tar

✅ S3 backup has been configured successfully!

Was this article helpful?