Tutorials · DevSecOps & Cloud
How to Back Up Servers to the Cloud With restic and Immutable Storage (3-2-1-1-0)
Follow the 3-2-1-1-0 rule: three copies, two media, one offsite, one immutable, zero errors on restore tests. Back up Linux and Windows servers to S3-compatible storage with restic and object lock.
Before you start
- S3-compatible object storage with object lock (AWS S3, Wasabi, Backblaze B2, MinIO or similar)
- restic on the servers to protect
Step by step
Create an immutable bucket
Enable versioning and object lock (compliance or governance mode) with a retention of, for example, 30 days, so nobody can delete backups early, not even an attacker with your keys.
Create a limited access key
The backup key may write and read, but not change bucket settings or delete locked objects.
Initialise the repository
restic encrypts everything on the client before upload. Store the repository password in your password manager.
export AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=... export RESTIC_REPOSITORY=s3:https://s3.eu-central-1.amazonaws.com/corp-backups/srv01 export RESTIC_PASSWORD_FILE=/root/.restic-pass restic init
Run the backup
Back up data folders and exclude caches.
restic backup /etc /srv /var/lib/app --exclude-cachesSchedule and keep a retention policy
Run nightly with a systemd timer or cron, then thin out old snapshots.
restic forget --keep-daily 14 --keep-weekly 8 --keep-monthly 12 --pruneVerify
Check the repository and read part of the data back every week.
restic check --read-data-subset=5%Test a real restore
Every month restore a folder or a whole server to a test machine and confirm the application works. A backup you never restored is not a backup.
Commands are generic, industry-standard examples. Exact syntax and menu names vary by model and firmware; check your device's manual on the Documentation page.
Pro tips
- Keep one local copy (NAS) for fast restores and the cloud copy for disasters.
- Put backup servers and storage in their own network segment with strict firewall rules.
- Monitor backup jobs: an alert for every failed or missing backup.
FAQ
Frequently asked questions
Is cloud storage safe for sensitive data?
restic encrypts data with your password before it leaves the server. Also choose a storage region that matches your data protection requirements.
Keep learning
Related guides
Protect backups from ransomware
Read more →Network disaster recovery plan
Read more →Back up network device configs
Read more →How to Scan Container Images, Code and IaC for Vulnerabilities With Trivy
Trivy is a free scanner for container images, file systems, Git repositories and infrastructure-as-code. Find vulnerable packages and misconfigurations before they reach production.
Read more →How to Generate an SBOM for Your Software and Scan It With Grype
A Software Bill of Materials lists every component in your software. Customers and regulations (such as the EU Cyber Resilience Act) increasingly ask for it. Generate SBOMs with Syft and check them for vulnerabilities with Grype.
Read more →How to Add Security Checks to a CI/CD Pipeline (Secrets, SAST, Dependencies, Images)
Shift security left: catch leaked secrets, insecure code, vulnerable dependencies and risky infrastructure settings automatically on every commit, before anything is deployed.
Read more →Stuck on a step?
Ask Navijin technical support or an authorised partner for help with your configuration.