Skip to content

Cloud backups: the 3-2-1 rule and restore testing

B2Bnetwork team · · 7 min

Integrations, data and cloud

In brief

The 3-2-1 rule says: keep three copies of important data (the original and two backups), on two different types of media, with one of them away from the primary site. In the cloud that means backups in a separate account or subscription, in another region, locked against deletion and out of reach of the same administrator credentials. A backup nobody has restored is only an assumption, so restore tests that measure time and data completeness have to run regularly.

The 3-2-1 rule and how to read it in the cloud

The 3-2-1 rule has no single normative source, but it is widely used and also described in government documents, for example the "Data Backup Options" guide produced for US-CERT and published today on the website of the US agency CISA. Its three elements:

  • 3 copies: one original and two backups;
  • 2 different media, so that one event cannot destroy every copy;
  • 1 copy offsite, in case of fire, flood or theft.

The rule comes from the era of disks and tapes. In the cloud, "media" and "site" need to be translated into boundaries that genuinely separate failures and attacks:

Rule elementData centerCloud
Originaldatabase on a storage arraydatabase in a managed service or on a virtual machine
Copy 1copy on a separate backup serversnapshot or backup in the backup service of the same account
Copy 2, offsitetapes in an external vaultcopy in a separate account, in another region, locked against deletion
Second media typedisk and tapea different storage service or a different provider

Many teams find it useful to extend the rule with an immutable copy (one that cannot be deleted or changed until retention ends) and zero errors in the latest restore test.

Replication is not a backup

The cloud offers replication across zones and regions, and it is tempting to treat that as a backup. Replication protects against hardware or zone failure, but it also faithfully copies mistakes: a dropped table, files encrypted by ransomware, a broken schema migration. A backup must protect a past state, so it needs versions and retention.

The second trap is the shared responsibility model. The cloud provider is responsible for the availability of its infrastructure; whether you have a copy of your data and can restore it is your responsibility. Snapshots kept in the same account as production can be deleted by anyone who takes over the administrator account.

RPO and RTO: how much data and time you can lose

NIST SP 800-34 describes two parameters that drive the whole backup strategy:

  • RPO (recovery point objective): the point in time to which data must be recoverable, in other words how much data the business can afford to lose. An RPO of 15 minutes means a backup or transaction log at least every 15 minutes.
  • RTO (recovery time objective): the maximum time within which the system must be running again.

These parameters are set with the business for each system separately, in a business impact analysis, described in the article on business continuity, BCP and DRP. An example split:

System classExampleRPORTOApproach
Critical transactionalpayment systemminuteshourscontinuous log archiving, replica in a second region, immutable backups
ImportantCRM, ERPa few hoursone daybackups several times a day, copy in a second account
Supportingwiki, test environmentsone daya few daysdaily backup or rebuild from infrastructure as code

The numbers in the table illustrate the method and are not a recommendation for any specific system. For databases, a low RPO comes from point-in-time recovery: PostgreSQL combines a base backup with an archive of WAL files and can restore the state at any moment covered by the archive.

Immutable backups and a separate account

An attacker who takes over administrator rights usually deletes the backups first. That is why the offsite copy should be:

  • in a separate account or subscription, with separate credentials and MFA, to which the production account can only write;
  • immutable. AWS Backup Vault Lock in compliance mode, once a grace time of at least 3 days has passed, prevents backups from being deleted before their retention ends, even by the account administrator or by AWS itself. Azure Backup has an immutable vault whose lock is irreversible;
  • encrypted with a key that will not disappear together with production, because a backup without its key is useless.

The lock has a cost: you cannot delete backups in a locked vault before their retention ends, so a badly chosen retention means ongoing charges. Retention needs to cover the time an attack might have gone unnoticed.

A database backup is not everything. Recovery also needs configuration, secrets, certificates and infrastructure definitions. The last of these is easiest to rebuild when it is written as infrastructure as code, and secrets live in a vault with its own backup, as we describe in the article on secrets in applications.

Restore testing step by step

AWS Well-Architected recommends, in its reliability pillar, periodic data recovery to verify the integrity of backups and processes. In financial services, DORA (Article 12) requires periodic testing of backup procedures and of restoration and recovery, and restoring on your own systems has to happen on ICT systems physically and logically segregated from the source system.

A test plan:

  1. Choose the scope: a single table, a whole database, a whole system with the application, or a recovery exercise in a second region.
  2. Restore into an isolated environment, with no connection to production, so the test cannot overwrite anything.
  3. Measure the time from the decision to restore to a working service and compare it with the RTO.
  4. Check the data: record counts, control totals, the latest transaction in the backup compared against the RPO.
  5. Check that the application works: login, a key transaction, a report. A database that restored while the application will not start is a failed test.
  6. Record the result and the fixes: who restored, how long it took, what did not work, who will fix it and when.

Automate the test for critical databases, for example a weekly restore of yesterday's backup with automatic data checks, and run full system exercises less often with the team involved. Restore exercises are also part of the ransomware scenario in a security incident response plan. That is how we built backups and tests on the cloud platform for a payments fintech.

Questions and answers

What is the 3-2-1 backup rule?

You keep three copies of your data: the original and two backups. The copies sit on two different types of media, and one of them is stored away from the primary site. In the cloud, the second medium is often a different storage service or another provider, and the offsite location is a separate account in another region, locked against deletion.

Does my cloud provider back up my data for me?

The provider takes care of the durability and availability of its infrastructure, and managed services often have built-in backups. Whether backups cover all the data you need, how long they are kept, whether they are out of reach of a compromised account and whether you can restore them is your responsibility. Default settings rarely meet a company's RPO, RTO and retention requirements.

How often should you test backup restores?

It depends on how critical the system is and on regulatory requirements. For critical databases, an automated weekly or monthly restore with data checks works well. A full recovery exercise of a system with its application usually happens a few times a year and after every major architecture change. More important than frequency is recording the result and fixing whatever did not work.

What is an immutable backup?

It is a backup that cannot be deleted or modified until its retention period ends, even with administrator rights. In the cloud this is provided, for example, by AWS Backup Vault Lock in compliance mode and by locked immutable vaults in Azure Backup. It protects against ransomware and against an attacker who has taken over an account and tries to delete backups before encrypting the data.

What it looks like in a project

Connecting systems or moving them to the cloud? Talk to an architect.

Let's talk

Read more: Integrations, data and cloud