AWS backups that survive a stolen admin login

Most AWS backups live in the same account as production and can be deleted with the same admin role. Here is how a backup account, Vault Lock and restore tests give you an architecture that survives ransomware.

Tomislav PreeAWS Cloud Architect from Mainz
December 3, 20268 min read
Contents
  1. Key takeaways
  2. Why backups in the same account are not protection
  3. The target architecture: three accounts, one direction
  4. Restore tests as evidence
  5. What it costs and where it hurts
  6. My recommendation
  7. Frequently asked questions

Key takeaways

  • Backups in the same AWS account as production can be deleted by anyone with admin rights there.
  • Copy every recovery point into a separate backup account with Vault Lock in compliance mode or into a logically air-gapped vault.
  • A backup policy in AWS Organizations and an SCP stop a workload admin from switching backups off.
  • Monthly restore tests in a recovery account give you the evidence auditors and NIS2 expect.
  • Always set a maximum retention, because mistakes in compliance mode cannot be undone.

Almost every AWS environment I look at with a new client has backups. RDS snapshots run daily, there is a backup plan for the EC2 volumes, and when I ask about ransomware the answer is usually "we have backups". The problem shows up when you ask where those backups live and who can delete them. In most cases they sit in the same AWS account as production, encrypted with the same KMS key and deletable by the same admin role that manages the database.

Those backups protect you against a dropped table. They do not protect you against the way most ransomware attacks in the cloud start: a stolen access key or a hijacked SSO session with admin rights. An attacker with those rights deletes the snapshots first and encrypts second. So my argument here is simple. A backup only counts if a compromised production admin cannot delete it, and if you prove on a schedule that you can restore it.

Why backups in the same account are not protection

The AWS policy AdministratorAccess includes backup:DeleteRecoveryPoint, ec2:DeleteSnapshot and rds:DeleteDBSnapshot. Anyone holding that role can remove every recovery point in the account within minutes, and the script for it is shorter than this paragraph. There is a quieter route too. If all backups use one customer managed key, a single kms:ScheduleKeyDeletion is enough. After the 7 to 30 day waiting period the key is gone, and with it every snapshot it encrypted. If nobody watches CloudTrail for KMS events, the backups still exist on paper and are useless in practice.

A second AWS account on its own does not fix this. If the same SSO user is admin in both accounts, the attacker has both. The separation has to come from three things: an account that only AWS Backup writes to, a lock that no admin can lift, and an organization rule that stops anyone from switching the whole thing off.

The target architecture: three accounts, one direction

This is the setup I now build as the default for companies without their own cloud team. Data moves in one direction only: from production into the locked backup account, and from there, shared read-only, into a recovery account.

Three accounts, one direction: production writes, the backup account locks, the recovery account tests.Open diagram in a new tab

In the workload account an AWS Backup plan picks resources by a tag such as backup=daily. It writes to a local vault with short retention, around 7 days. Everyday restores come from there, when someone drops a table or a deployment corrupts data. Right after each backup a copy job sends the recovery point to the separate backup account. There the copy sits in a vault with a compliance lock for 35 to 90 days. For restore tests and for the real incident you share that vault through AWS RAM with a third account, and you restore there without touching a production account that may be compromised.

Backup policies instead of console clicks

You do not define the plan in the workload account. You define it as a backup policy in AWS Organizations. Because the policy comes from the management account, an admin in the workload account cannot change or delete the plan. For the copy to work you have to turn on cross-account backup in the AWS Backup settings of the management account. A shortened policy looks like this:

{
  "plans": {
    "prod-daily": {
      "regions": { "@@assign": ["eu-central-1"] },
      "rules": {
        "daily": {
          "schedule_expression": { "@@assign": "cron(0 2 ? * * *)" },
          "target_backup_vault_name": { "@@assign": "local-vault" },
          "lifecycle": { "delete_after_days": { "@@assign": "7" } },
          "copy_actions": {
            "arn:aws:backup:eu-central-1:111122223333:backup-vault:central-locked": {
              "target_backup_vault_arn": {
                "@@assign": "arn:aws:backup:eu-central-1:111122223333:backup-vault:central-locked"
              },
              "lifecycle": { "delete_after_days": { "@@assign": "35" } }
            }
          }
        }
      },
      "selections": {
        "tags": {
          "prod": {
            "iam_role_arn": { "@@assign": "arn:aws:iam::$account:role/AWSBackupDefaultRole" },
            "tag_key": { "@@assign": "backup" },
            "tag_value": { "@@assign": ["daily"] }
          }
        }
      }
    }
  }
}

Selecting by tag has a practical benefit. A new database is backed up the moment your Terraform module sets the tag. I make it the module default for that reason, not an optional variable someone has to remember.

Vault Lock: governance or compliance

AWS Backup Vault Lock has two modes. In governance mode a user with the right IAM permissions can remove the lock again. That guards against mistakes, not against a stolen admin login. Compliance mode has a grace period of at least 72 hours. After it ends, nobody can remove the lock or delete locked recovery points before their retention runs out. That includes the root user and AWS itself.

aws backup put-backup-vault-lock-configuration \
  --backup-vault-name central-locked \
  --min-retention-days 35 \
  --max-retention-days 90 \
  --changeable-for-days 3

The alternative is a logically air-gapped vault, generally available since August 2024. It is its own vault type, always locked in compliance mode, and you can share it through AWS RAM with other accounts, even outside your organization. The other account can restore from it directly without copying first. For the case where your whole organization is compromised, AWS adds multi-party approval, where a team you named in advance has to approve access. My advice: if all your resource types are supported, use the air-gapped vault. Check Aurora, DocumentDB and Neptune first, because cross-region copies have limits there.

An SCP against switching it off

The last gap is the workload admin who cannot touch the backup account but can empty the local vault or tamper with the lock in their own account. A service control policy on the production OU closes it:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DenyBackupTampering",
      "Effect": "Deny",
      "Action": [
        "backup:DeleteRecoveryPoint",
        "backup:DeleteBackupVault",
        "backup:DeleteBackupVaultLockConfiguration",
        "backup:PutBackupVaultAccessPolicy",
        "backup:UpdateRecoveryPointLifecycle"
      ],
      "Resource": "*",
      "Condition": {
        "ArnNotLike": { "aws:PrincipalArn": "arn:aws:iam::*:role/BreakGlassBackupAdmin" }
      }
    }
  ]
}

Make the break-glass role reachable only with MFA from the management account, and let every use of it trigger an alarm.

Restore tests as evidence

A backup you have never restored is an assumption. AWS Backup has offered restore testing since late 2023. You define a test plan, monthly for example, and AWS Backup restores the latest recovery point of the selected resources on its own. The restored resources stay up for 1 to 168 hours and are then deleted automatically. Inside that window a Lambda function, triggered through EventBridge, can check whether the data is usable, for example whether the most important table has rows from yesterday, and report the result back to AWS Backup.

I run these tests in the recovery account because that is where the real incident will happen. You test at the same time whether networking, subnets and KMS permissions fit together there. The results flow into AWS Backup Audit Manager, which turns them into reports. Those reports are what an auditor asks for, and NIS2 names backup management and disaster recovery explicitly as part of the risk measures in Article 21.

What it costs and where it hurts

The copy in the backup account roughly doubles your backup storage, and restore tests cost a few hours of runtime for the restored instances. For a typical SaaS setup with a 200 GB RDS database and a handful of EC2 volumes, this came to a low three-figure amount per month in my projects. Run your own volumes through the AWS Pricing Calculator before you fix the retention.

The bigger pain is that nothing can be undone. If a copy rule with a compliance lock sets 3650 days of retention instead of 35 by mistake, you pay for those recovery points for ten years, and nobody can delete them. Always set --max-retention-days so AWS Backup rejects copies with retention that is too long, and use the 72 hour grace period for a real test.

Then there is recovery time. A restore from the shared vault into another account takes longer than a restore from the local vault, and the recovery account needs a prepared network. That is why the local 7 day vault stays. It is for everyday mistakes, and the locked account is for the worst day of the year.

My recommendation

If you are starting from zero, go in this order. In week one, create the backup account and the recovery account in AWS Organizations and turn on cross-account backup. In week two, replace your existing backup plans with a backup policy that selects by tag and copies to the backup account, and set the lock in governance mode first. Only when the copies have run cleanly for a week and the retention is right do you switch to compliance mode and attach the SCP. Then run the first restore test, before anyone needs it for an audit.

For a manageable environment this takes a few days. If you want to know where your backups live today and who can delete them, my free AWS security check shows you the biggest gaps in five minutes. If you cannot answer that question today, you will otherwise find the answer on the day the snapshots are already gone.

Frequently asked questions

What is the difference between governance and compliance mode in AWS Backup Vault Lock?

In governance mode a user with the right IAM permissions can remove the lock again. In compliance mode the lock becomes immutable after a grace period of at least 72 hours, even for the root user and AWS. Only compliance mode protects you against a stolen admin login.

What is a logically air-gapped vault in AWS Backup?

It is a separate vault type that is always locked in compliance mode and can be shared through AWS RAM with other accounts, even outside your organization. Those accounts can restore from it directly. It has been generally available since August 2024.

How do I test AWS backups automatically?

AWS Backup restore testing lets you define a plan that restores the latest recovery point on a schedule. The restored resources stay up for 1 to 168 hours and are then deleted. A Lambda function can check the data in that window and report the result back to AWS Backup.

Does NIS2 require backups and restore tests?

NIS2 names backup management and disaster recovery explicitly as part of the risk measures in Article 21. The directive does not prescribe how you implement them. Regular, documented restore tests are the simplest proof that your backups work.

Sources

  1. AWS Backup Vault Lock (AWS Backup Developer Guide)
  2. PutBackupVaultLockConfiguration (AWS Backup API Reference)
  3. Logically air-gapped vault (AWS Backup Developer Guide)
  4. Announcing the general availability of AWS Backup logically air-gapped vault
  5. Multi-party approval for logically air-gapped vaults
  6. Restore testing (AWS Backup Developer Guide)
  7. Restore testing validation (AWS Backup Developer Guide)
  8. Automatic restore testing and validation is now available in AWS Backup (AWS News Blog)
  9. Troubleshooting undeletable recovery points in compliance mode vaults (AWS re:Post)
Tomislav Pree

Tomislav Pree

Cloud Architect based in Mainz, building AWS platforms and writing about GitOps, Kubernetes, and MLOps.