Back to articles
AI & Cloud

Immutable Backup Architecture: Comprehensive Ransomware Protection for VPS Using Kopia and AWS S3 Object Lock

Detailed guide to building an immutable backup system for VPS using Kopia and AWS S3 Object Lock, protecting data from ransomware with configuration, verification, and troubleshooting.

DPTCloud Engineering4 min read
Immutable Backup Architecture: Comprehensive Ransomware Protection for VPS Using Kopia and AWS S3 Object Lock

Introduction to Immutable Backup

In the face of increasingly sophisticated ransomware attacks, protecting data on Virtual Private Servers (VPS) has become critical. Immutable backup, or non-modifiable backup, is an advanced solution that prevents data from being deleted, altered, or encrypted by malware. This guide walks through building a comprehensive immutable backup system for VPS using Kopia – an open-source backup tool – combined with AWS S3 Object Lock to ensure data integrity and recovery capabilities.

Prerequisites

To implement this architecture, you will need:

  • A VPS with root or sudo access.
  • An AWS account with S3 and IAM (Identity and Access Management) permissions.
  • Kopia installed on the VPS (supports Linux, macOS, Windows).
  • Familiarity with AWS CLI and AWS SDK setup.

Setting Up Kopia with AWS S3 Object Lock

We will use Kopia to create scheduled backups and store them in AWS S3 with Object Lock enabled to prevent deletion or modification.

1. Install Kopia

On the VPS, install Kopia using the following command (for Linux):

curl -sSf https://kopia.io/install.sh | sh

2. Initialize Kopia Repository

Initialize the backup repository in S3 with this command:

kopia repository create s3 --bucket=my-backup-bucket --endpoint=https://s3.amazonaws.com --access-key=YOUR_AWS_ACCESS_KEY --secret-key=YOUR_AWS_SECRET_KEY

Replace my-backup-bucket with your S3 bucket name. Ensure the bucket is configured with Object Lock.

3. Configure Object Lock on AWS S3

In the AWS Console, navigate to S3 → Bucket → Object Lock Configuration:

  • Set Retention Mode to Compliance.
  • Set Retention Period to your desired protection duration (e.g., 365 days).
  • Enable Lock and Retain to prevent deletion.

4. Set Up Backup Schedule

Create a daily backup schedule with the following command:

kopia policy set --schedule="daily" --retention=30d --include=/home --include=/var/www

This will back up the /home and /var/www directories daily and retain backups for 30 days.

Verification and Troubleshooting

To ensure the system functions correctly, perform the following checks:

1. Check Kopia Status

Run this command to verify backup snapshots:

kopia snapshot list

This displays all created backup snapshots.

2. Verify Object Lock on AWS

Access the AWS S3 Console, select your bucket, and confirm that backup objects are protected by Object Lock.

3. Troubleshooting

  • If Kopia cannot connect to S3: Check IAM permissions, access key, and endpoint.
  • If backups are not created: Verify the backup schedule and directory access permissions.
  • If Object Lock is not working: Review bucket configuration and IAM policies.

Reference Resources

Assumptions: The user has an AWS account and knows how to configure S3. Kopia is installed and configured correctly. No performance or response time data is provided as no specific test data is available.

DPTCloud Tier III Infrastructure

High-RAM Cloud VPS Plans Optimized for AI, Databases & Cache

Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.

View 22 VPS Plans
ECO · vn-02Recommended

VPS-4E

297.000 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe
ECO · vn-02

VPS-5E

614.900 ₫ / mo

10% VAT included

  • CPU: 8 vCPU
  • RAM: 16 GB
  • SSD: 100 GB NVMe
ADVANCED · vn-03Recommended

VPS-4T

548.900 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe

Related Articles

View all
ZaloZalo SupportDiscord0384 753 478