Since the first lesson of the course, Verdalia has been dragging one sentence along: every night a copy of the database is made, and nobody has ever tried to restore it. The five previous lessons tried to keep things from going wrong. This one is about what happens when they go wrong anyway: an accidental deletion, a deployment that corrupts a table, a disk that fails, or a data center that disappears. You will learn why a replica is not a backup, which types of backup exist, how recovery objectives are set with the business, and how a disaster recovery plan is prepared. Verdalia will finally restore one of its backups, and what it discovers will close the oldest risk in the course. This lesson ends Module 5.
One warning: the procedures in this lesson are didactic examples. In a real system, the backup policy and the recovery plan must be reviewed with a security professional and, since backups contain personal data, with legal and compliance advice (GDPR, PCI DSS).
Why a Replica Is Not a Backup
In Module 4, Verdalia added a replica of its database, and we left a warning in writing: a replica is not a backup. The replica reproduces, in milliseconds, everything that happens on the primary. Including the mistakes.
| Event | Does the replica protect? | Does the backup protect? |
|---|---|---|
| The primary's disk breaks down | Yes: the replica is promoted | Yes, but more slowly |
Someone runs a DELETE without a condition |
No: the deletion is replicated | Yes |
| A faulty deployment corrupts the amounts | No | Yes |
| A malicious program encrypts the data | No | Yes, if the backup is out of its reach |
| The data center is lost | No, if the replica is in the same one | Yes, if the backup is somewhere else |
The replica protects availability against breakdowns. The backup protects the data against everything else, because it preserves the past. You need both.
Types of Backup
Full, Incremental, and Differential
| Type | What it copies | Backing up | Restoring |
|---|---|---|---|
| Full | All the data | Slow, and takes up a lot of space | Fast: one backup is enough |
| Incremental | What has changed since the last backup, of whatever type | Very fast | Slow: the full one and every incremental, in order. If one fails, everything after it is lost |
| Differential | What has changed since the last full backup | Intermediate; grows every day | Intermediate: the full one and the last differential |
The usual approach is to combine them: a weekly full backup and daily incremental or differential backups.
Logical and Physical
| Type | What it contains | Advantage | Drawback |
|---|---|---|---|
| Logical | The statements or the data needed to rebuild the database: a dump | Portable across versions; allows restoring a single table | Slow to restore on large databases |
| Physical | The database files, as they are on disk | Fast; it is the basis of point-in-time recovery | Tied to the version and the configuration |
Point-in-Time Recovery
A database writes every change to a transaction log before applying it. If a physical backup is kept and, from it onward, every file of that log, the state of the database can be rebuilt at any instant: the backup is restored and the changes are replayed up to the chosen moment. It is point-in-time recovery, or PITR. It lets you go back to 11:42 a.m., one minute before the deletion, instead of to 3:00 a.m.
The 3-2-1 Rule and Immutable Backups
The 3-2-1 rule sums up decades of experience:
| Number | Meaning | Protects against |
|---|---|---|
| 3 | Three copies of the data: the original and two backups | The failure of one backup |
| 2 | On two different media or storage systems | A failure common to the medium or the provider |
| 1 | One of them, away from where the original is | A fire, a theft, or the loss of the data center |
The 3-2-1-1-0 variant adds two conditions: one immutable or offline backup, and zero errors in verification.
The immutable backup answers ransomware, the malicious program that encrypts the data and demands a ransom. Whoever operates it looks for the backups first and destroys them. A backup reachable with the same credentials as the data falls with it. There are two defenses:
- Immutable backup. The storage prevents modifying or deleting it for a set period, even for someone with administrator credentials.
- Offline backup. It is not connected to anything: it cannot be reached over the network.
In addition, backups are encrypted, before they leave the machine. They contain the same as the database and travel farther. The encryption key is kept separately, and in more than one place: an encrypted backup whose key has been lost is not a backup.
RPO and RTO
Two figures define what is expected from a recovery:
| Objective | Question | Measured in | Determined by |
|---|---|---|---|
| RPO, recovery point objective | How much data can we afford to lose? | Time: the changes of the last 15 minutes | The frequency of the backups |
| RTO, recovery time objective | How long can we take to be running again? | Time: 2 hours from the disaster | The speed of the restore, including detection and decision |
flowchart LR
backup["Last valid backup"] -->|"RPO: data lost"| disaster["Disaster"]
disaster -->|"RTO: time without service"| service["Service recovered"]
How They Are Set
They are business decisions, not technical ones. The question to the business is not how much it wants to lose, because the answer is always “nothing,” but how much each hour of lost data and each hour of downtime costs, and how much it is willing to pay to reduce them. Getting close to zero costs more and more:
| Option | RPO | RTO | Monthly cost for Verdalia |
|---|---|---|---|
| Nightly backup, outside the data center | 24 hours | 4 hours | €3 |
| The above, plus continuous archiving of the transaction log | 15 minutes | 2 hours | €6 |
| Synchronous replica in another data center, with automatic failover | Near zero | Minutes | Over €150, and tools the team does not know |
One Objective per Data Store
Not all data is worth the same. These are the objectives Marta agreed on with Andrés on April 22:
| Data store | What it contains | RPO | RTO | Mechanism |
|---|---|---|---|---|
| PostgreSQL | Orders, customers, stock, and catalog | 15 minutes | 2 hours | Weekly physical backup, continuous log archiving, and nightly logical dump |
| Redis | Sessions, carts, and cache | 24 hours for the carts; the rest is not backed up | 1 hour | Daily copy of the persistence file. Sessions are lost: customers log in again. The cache regenerates |
| RabbitMQ | Messages in transit | Messages are not backed up | 1 hour | Backup of the definition of queues, users, and permissions. Pending emails are regenerated from the confirmed orders |
| Object storage | 52,000 images | 24 hours | 4 hours | Provider versioning and weekly copy at a second provider |
notification-service data store |
Sent notifications | 24 hours | 4 hours | Nightly dump |
| Repositories and configuration | Code, ADRs, runbooks, Nginx configuration, and network rules | 24 hours | 4 hours | External repository service and weekly copy. The environment files and the keys, encrypted, in the team's password manager |
The last row is often forgotten. Restored data is useless without the code, the configuration, and the keys that make it work.
A Backup That Has Not Been Restored Is Not a Backup
What the business needs is not a backup, but a restore. The backup is the means. Until it has been restored, nobody knows whether the file is complete, whether it contains what it should, whether the key to decrypt it exists, how long it takes, or whether anyone knows how to do it. It is the same idea that closed Module 4: a recovery mechanism that has never been tested is a hypothesis.
| Check | Frequency | What it detects |
|---|---|---|
| The backup finished without errors, and its size is similar to the previous one | Every backup | Empty or interrupted backups |
| The checksum matches | Every backup and every restore | Altered or damaged backups |
| Full restore on a separate machine, with verification of the data | Every month | Everything else, and the real restore time |
| Restore done by someone other than the usual person | Every quarter | Procedures only their author understands |
The Disaster Recovery Plan
A disaster recovery plan describes how the system is brought back after a serious event. It is built by scenarios.
Strategies
| Strategy | What it consists of | RTO | RPO | Cost |
|---|---|---|---|---|
| Backup and restore | There are only backups in a second location. The infrastructure is created after the disaster | Hours or days | Hours | Low |
| Pilot light | In the second location, only the minimum is running, usually the replicated database. The rest is started when needed | From tens of minutes to hours | Minutes | Medium |
| Warm standby | A complete, scaled-down copy of the system runs in the second location and is scaled up when needed | Minutes | Seconds or minutes | High |
| Multi-site active-active | Two locations serve traffic at the same time | Near zero | Near zero | Very high, and it requires solving data consistency between sites |
Runbooks and Drills
A runbook is the written, step-by-step procedure for a specific operation. It must be something a person who did not write it can follow at four in the morning. It states who decides, who is notified, what is run, and how the result is checked. And it must be available when the system is not: a procedure stored only on the server that is down is useless.
Plans are tested with drills, like those in Module 4. A plan without a drill describes what the team believes it would do.
Disaster recovery deals with systems. The business continuity plan is broader: how the company keeps operating in the meantime. Who informs the customers, how orders already paid are handled, and what is done with the shipments in progress. It is the business's responsibility, with technical support.
Backup, Verification, and Restore in Python
The example uses SQLite, which comes with Python, to show the full cycle without installing anything:
import hashlib
import shutil
import sqlite3
import tempfile
from contextlib import closing
from datetime import datetime, timedelta
from pathlib import Path
class InvalidBackup(Exception):
pass
def checksum(path):
return hashlib.sha256(Path(path).read_bytes()).hexdigest()
def back_up(source, target):
"""Consistent copy of a SQLite database, even while it is in use."""
with closing(sqlite3.connect(source)) as db, closing(sqlite3.connect(target)) as backup:
db.backup(backup)
return checksum(target)
def summary(path):
"""What the business would recognize: how many orders there are and what they add up to."""
with closing(sqlite3.connect(path)) as db:
status = db.execute("PRAGMA integrity_check").fetchone()[0]
orders, amount = db.execute("SELECT COUNT(*), TOTAL(amount) FROM orders").fetchone()
return status, orders, round(amount, 2)
def restore(backup, expected_checksum, target, minimum_orders):
if checksum(backup) != expected_checksum:
raise InvalidBackup("checksum does not match")
shutil.copyfile(backup, target)
status, orders, amount = summary(target)
if status != "ok" or orders < minimum_orders:
raise InvalidBackup(f"unexpected contents: {orders} orders")
return orders, amount
def meets_rpo(valid_backup_dates, now, rpo):
"""The last valid backup cannot be older than the RPO."""
age = now - max(valid_backup_dates)
return age <= rpo, age
def create_db(path, orders):
with closing(sqlite3.connect(path)) as db:
db.execute("CREATE TABLE orders (id INTEGER PRIMARY KEY, amount REAL, status TEXT)")
db.executemany("INSERT INTO orders VALUES (?, ?, ?)", orders)
db.commit()
with tempfile.TemporaryDirectory() as folder:
folder = Path(folder)
production = folder / "production.db"
create_db(production, [(1042, 44.88, "confirmed"), (1043, 120.0, "confirmed"),
(1044, 39.93, "shipped"), (1045, 18.5, "confirmed")])
# 1. Backup, with its checksum
backup = folder / "backup-2027-04-28.db"
digest = back_up(production, backup)
print("1. Backup done. Checksum:", digest[:12] + "...", "Contents:", summary(backup))
# 2. Disaster: an accidental deletion in production
with closing(sqlite3.connect(production)) as db:
db.execute("DELETE FROM orders")
db.commit()
print("2. Production after the deletion:", summary(production))
# 3. Restore to another location, and verification
print("3. Restored (orders, amount):", restore(backup, digest, folder / "restored.db", 1))
# 4. A tampered backup
corrupt = folder / "backup-corrupt.db"
corrupt.write_bytes(backup.read_bytes()[:-100] + b"\0" * 100)
# 5. An empty backup, with a flawless checksum
create_db(folder / "empty.db", [])
empty = folder / "backup-empty.db"
empty_digest = back_up(folder / "empty.db", empty)
for number, file, expected in ((4, corrupt, digest), (5, empty, empty_digest)):
try:
restore(file, expected, folder / "test.db", 1)
except InvalidBackup as error:
print(f"{number}. {file.name}: rejected, {error}")
# 6. Is the RPO met?
valid = [datetime(2027, 3, day, 3, 0) for day in range(10, 31)] # March 10 to 30
for now, rpo in ((datetime(2027, 3, 30, 17, 0), timedelta(hours=24)),
(datetime(2027, 4, 21, 10, 0), timedelta(hours=24))):
meets, age = meets_rpo(valid, now, rpo)
print(f"6. {now:%Y-%m-%d %H:%M}: last valid backup {age} ago. Meets the RPO: {meets}")Output (the checksum may vary with the SQLite version):
1. Backup done. Checksum: f5de272c1e84... Contents: ('ok', 4, 223.31)
2. Production after the deletion: ('ok', 0, 0.0)
3. Restored (orders, amount): (4, 223.31)
4. backup-corrupt.db: rejected, checksum does not match
5. backup-empty.db: rejected, unexpected contents: 0 orders
6. 2027-03-30 17:00: last valid backup 14:00:00 ago. Meets the RPO: True
6. 2027-04-21 10:00: last valid backup 22 days, 7:00:00 ago. Meets the RPO: FalseExplanation:
db.backup(backup)is SQLite's mechanism for copying a database that is in use and getting a consistent result. Simply copying the file, while someone is writing, can produce an unusable copy. Each database has its own tool.checksumcomputes the SHA-256 of the file. It is stored next to the backup and checked before restoring. Here a fast function is the right choice: it does not protect a secret, it detects changes.summarychecks the internal integrity of the database and computes two figures the business can cross-check.TOTALis likeSUM, but returns 0 when there are no rows.restorenever writes over production: it restores to another location and verifies. Overwriting the damaged data with an unchecked backup can destroy the only thing that was left.- Case 5 is the most important one. An empty backup has a perfect checksum. The checksum proves that the file has not changed since it was created, not that it contains what it should. Only the content check detects it.
meets_rpoworks with the valid backups, not with the ones that exist. The second check reproduces what Verdalia found on April 21.
Reference: PostgreSQL
The PostgreSQL equivalent uses pg_dump and pg_restore. The snippet is a reference, not a program ready to run:
#!/usr/bin/env bash
# nightly-backup.sh
set -euo pipefail # stops on any error, including inside a pipeline
DATE=$(date +%F)
FILE="/var/backups/verdalia-${DATE}.dump"
# The password of the "backups" user is not in the script: it comes from the environment
pg_dump --host=verdalia-db-02 --username=backups --dbname=verdalia \
--format=custom --file="${FILE}"
sha256sum "${FILE}" > "${FILE}.sha256"
# Minimal check: the dump can be read and contains the orders
pg_restore --list "${FILE}" | grep -q "TABLE DATA public orders"
# Afterwards: encrypt and send outside the data center
# Restore, on another machine:
# sha256sum --check verdalia-2027-04-28.dump.sha256
# createdb verdalia_restored
# pg_restore --dbname=verdalia_restored --jobs=4 --no-owner verdalia-2027-04-28.dumpset -euo pipefailmakes the script fail if any command fails. Withoutpipefail, a pipeline returns the result of its last command, even if the first one failed.- The dump is taken from the replica, so as not to load the primary, with a read-only
backupsuser. --format=customproduces a compressed file thatpg_restorecan restore in parallel, with--jobs, or table by table.
Verdalia: The April 21 Drill
On Wednesday, April 21, Lucía and Íker rented a machine for one day, verdalia-restore-01, with a hypothesis: “Last night's backup can be restored in under two hours.” Since a restore contains real data, the machine was treated as part of production: inside the data zone, reachable only from the bastion, and destroyed when finished. The backups had been made on verdalia-db-01 since March 9, when the database moved to its own machine.
That night's backup was 20 bytes.
| Finding | Cause | Consequence |
|---|---|---|
| The backups of the last 22 nights were empty | The script connected as the user store, disabled on March 30 when the credentials were rotated |
The last valid backup was from March 30, at 3:00 a.m. |
| The script finished without error | It sent the dump to a compressor through a pipeline, without pipefail. The compressor compressed an empty input, successfully |
Nobody received any alert. There was nobody to alert, either |
| The old password was written in the script | The script is not in the repository, and it was left out of the ADR-007 inventory | A third copy of the credential, which nobody knew about |
| The backups were on the same disk as the database, unencrypted | The verdalia-prod-01 layout was reproduced on the new machine |
A failure of verdalia-db-01 would have taken the data and its backups with it |
| Restoring the March 30 backup took 2 hours and 10 minutes | There was no procedure. The restore itself took 52 minutes; the rest, figuring out how | The real RTO was unknown |
For three weeks of the campaign, Verdalia had no backups. An accidental deletion on April 20 would have meant losing about 2,000 orders, close to €90,000 in sales already paid, with no way of knowing what to ship or to whom. The replica would not have helped: it would have replicated the deletion.
There are two lessons. The first: the change that broke the backups was a security improvement, correct and well executed. In a system, every change has effects on pieces nobody remembers. The second: the risk that had been open since Module 1 was not that the backups might fail, but that nobody would have known. The drill cost €2 in rental and one morning.
The New Policy and ADR-009
ADR-009: Keep encrypted backups outside the data center, with point-in-time recovery and a tested restore every month
Status: Accepted
Date: 2027-04-23
Participants: Marta decides; Íker and Lucía consulted; Andrés sets the recovery objectives and accepts the business risks.
Context
The April 21 drill showed that the nightly backups had been empty for 22 nights, that they were stored unencrypted on the same disk as the database, and that there was no restore procedure. The business has set for PostgreSQL an RPO of 15 minutes and an RTO of 2 hours. The infrastructure is in a single data center and is administered by hand.
Options considered
- A. Fix the script and keep the layout. No cost. The backups stay on the same disk, and the RPO is 24 hours.
- B. Encrypted nightly backup, outside the data center. RPO of 24 hours.
- C. Option B, plus a weekly physical backup and continuous archiving of the transaction log, with a tested monthly restore. RPO of 15 minutes.
- D. Second data center with a replica and automatic failover. Exceeds the budget and the team's capacity.
Decision
We adopt option C. Backups are encrypted at the source and sent to the object storage of a second provider, in another city, with a 30-day deletion lock. A local copy is also kept on
verdalia-db-02, for fast restores. Daily backups are kept for 14 days, weekly ones for 8 weeks, and monthly ones for 12 months. On the first Thursday of every month, a backup is restored on a rented machine, the data is checked, and the time is recorded. The script alerts Lucía and Íker by email if a backup fails or if its size drops by more than 20%.Consequences
Positive:
- The 3-2-1 rule is met: the original and two backups, at two providers, one of them outside the data center and immutable.
- An accidental deletion is recovered to the previous minute.
- The restore time is a measurement, not an assumption.
Negative:
- €8 more a month: €6 for storage and €2 for the restore machine.
- One more key to safeguard. If it is lost, the backups are useless. It is kept in the team's password manager and, on paper, in the office safe.
- Data deleted at a customer's request remains in the backups for up to 12 months. A list of erasures is kept, and it is applied again after every restore.
Accepted risks:
- The loss of the data center is handled with backup and restore: reinstalling nine machines by hand, in another of the provider's data centers. The estimated RTO is 24 hours.
- The email alert is a minimal mechanism. There is no automated monitoring.
Review conditions
It will be reviewed when the store moves to a cloud platform, to assess managed backups and a pilot light strategy; if a monthly restore fails or exceeds 2 hours; and if the business changes the recovery objectives.
It is the third of the four decisions pending since Module 1. One remains: how to deploy without downtime.
The policy went into service on Tuesday, April 27. On Thursday, April 29, Íker, and not Lucía, did the first restore with the runbook docs/runbooks/postgresql-restore.md: he recovered the state of the database as of 6:00 p.m. the previous day in 38 minutes. The number of orders and the total amount matched those of production at that time. The check compares counts and amounts, without displaying personal data.
| Scenario | Response | RTO |
|---|---|---|
| Accidental deletion or deployment that corrupts data | Point-in-time recovery | 2 hours |
Breakdown of verdalia-db-01 |
Promotion of the replica, per ADR-006 | 12 to 19 minutes, plus detection |
| Malicious program that encrypts the data | Reinstallation and restore from the immutable backup | 1 to 2 days |
| Loss of the data center | Backup and restore in another of the provider's data centers | 24 hours |
Module 5 Review
The Threats
| Status | Threats |
|---|---|
| Mitigated | TH-01, TH-02, TH-03, TH-04, TH-06, TH-07, TH-08, TH-10, TH-11, TH-12, TH-14 |
| Avoided | TH-13: the customer export no longer exists |
| Transferred | TH-09: card data is handled by PagoRaíz |
| Partly mitigated | TH-05: the traffic to Redis and RabbitMQ is still unencrypted. TH-15: inactive accounts keep the old hash until July 6 |
| Accepted | TH-16: physical theft of a server; disk encryption is postponed |
QS-4: Met
On Wednesday, April 28, scenario QS-4 was verified, in three ways:
- Secret detector over the two repositories and their entire history: 0 findings. The detector also runs before every change.
- The old credentials do not work. The user
storecannot log in, and the old PagoRaíz key responds with an authentication error. - Simulated leak. Marta handed Íker a copy of the repository on a laptop without VPN, as if he were an outsider. He obtained no credentials and reached no service: from the internet, only the store and the VPN respond.
The backup drill added a nuance: the scenario spoke of the repository, and there was a credential outside it, in a script. The inventory of secrets now includes the servers.
The Scenarios and the Indicators
| Scenario | Status | Detail |
|---|---|---|
| QS-1, performance | Met | 590 ms at the 95th percentile with 1,000 users and internal encryption |
| QS-2, scalability | Partial | Adding capacity is still manual, and now it takes longer |
| QS-3, availability | Partial, strengthened | Verified backups, RPO of 15 minutes, and rate limiting. A failure of the primary still exceeds 5 minutes |
| QS-4, security | Met | 0 credentials in the repositories and in their history |
| QS-5, maintainability | Met once | No changes |
| QS-6, operability | Pending | Manual rolling deployment, with no rehearsed rollback |
| Indicator | March | End of April |
|---|---|---|
| Credentials in the repository | 2 | 0 |
| Critical security updates | Undefined | One, on April 14: applied in 31 hours on the nine machines, by hand |
| People with routine access to production data | The whole technical team | 2, with a personal user and logging |
| Administration reachable from the internet | SSH, with a shared account | Only the VPN, with a personal key |
| Backups restored successfully | 0 | 2 |
Accepted Risks and Cost
The following remain accepted, in writing: the unencrypted secrets in the servers' environment files, with manual rotation; the unencrypted traffic to Redis and RabbitMQ; the three services sharing verdalia-aux-01; the single data center, with an RTO of 24 hours; and the lack of automated detection of intrusions and outages.
| Item | Monthly cost |
|---|---|
| Module 4 architecture, during the campaign | €439 |
verdalia-bastion-01, size S |
€30 |
| Backups outside the data center and monthly restore | €8 |
| Total during the campaign | €477 |
Outside the campaign, with two application servers, it is €417. The annual average is €432, under the €500 limit.
The Day Before Mother's Day
In Module 4 we calculated that the day before Mother's Day would require a fourth application server, for 1,400 users. Lucía installed verdalia-app-04 on Wednesday, April 28. The network rules did not need to be touched. The setup checklist, which had 31 steps, now has 38: the environment file, the internal certificates, the local firewall, the personal accounts. It took her 2 hours and 15 minutes. The server, rented for 12 days, cost €24.
On Saturday, May 1, 2027, the email with the 15% discount went out at 10:30 a.m., as it had a year before. At 11:05 a.m. there were 1,260 simultaneous users. The catalog's 95th percentile was 610 ms. The rate limiter rejected 3,400 requests from a price comparison bot, which received code 429 without any customer noticing. Between 10:30 a.m. and 1:30 p.m., 263 orders were confirmed.
A year before, at 11:00 a.m., the store had gone down for three hours, at an estimated cost of €5,985. At 11:25 a.m., the time when Lucía had found out back then from a customer on social media, she was connected to the bastion, checking the logs of four servers by hand, one by one. There was nothing to see. But if there had been, it would have taken her a while to find it.
Common Mistakes and Tips
- Confusing the replica with the backup. The replica reproduces the mistakes in milliseconds.
- Storing the backups next to the data. On the same disk, on the same machine, or with the same credentials.
- Taking a backup as good because the script gives no error. Check the size, the contents, and, every month, the restore.
- Encrypting the backups and keeping the key only on the server being backed up. When it is needed, it will not be there.
- Setting the RPO and the RTO without the business. Either you overspend, or you find out too late that it was not enough.
- Forgetting what is not the database. Configuration, keys, certificates, queue definitions, and runbooks.
- Writing the procedure after the disaster. And storing it where it cannot be read when the system is down.
- Practical tip. Put the next restore on the calendar, with a person's name on it. If it has no date, it will not happen.
Exercises
Exercise 1: Calculate the Real RPO and RTO
An online academy makes a full backup every Sunday at 2:00 a.m. and incremental backups Monday through Saturday, at the same time. Restoring the full backup takes 3 hours, and each incremental, 20 minutes. On a Thursday at 4:00 p.m. the database gets corrupted, and the team takes 40 minutes to detect it and decide. Calculate the data lost and the time until the service is recovered. What would happen if Tuesday's incremental were damaged?
Exercise 2: Review This Policy
A store describes its policy this way: “We have a real-time replica and a daily backup on a disk attached to the server. The backups are encrypted, with a key stored on the server itself. We have never had to restore.” Identify the defects and propose improvements, using the 3-2-1 rule.
Solutions
Solution to Exercise 1
The last backup is Thursday's incremental at 2:00 a.m., so 14 hours of data are lost. To restore, you need Sunday's full backup and the incrementals from Monday, Tuesday, Wednesday, and Thursday: 3 hours plus 4 times 20 minutes, that is, 4 hours and 20 minutes. With the 40 minutes of detection and decision, the service comes back 5 hours after the failure, at 9:00 p.m.
If Tuesday's incremental were damaged, the chain would break: you could only restore up to Monday at 2:00 a.m., and more than three and a half days would be lost. That is the weakness of incremental backups. It is reduced with more frequent full backups, with differentials, or by verifying every backup. Common mistake: calculating the RTO without counting the detection time.
Solution to Exercise 2
| Defect | Improvement |
|---|---|
| The replica is counted as protection for the data | It is availability. It does not count as a backup |
| The only backup is on a disk attached to the server | A power failure, a theft, or a malicious program affects both. A backup is needed elsewhere, and if possible immutable |
| One backup, one medium, one place | With the original there are two copies, not three; one medium, not two; no external location |
| The key is on the server | If the server is lost, the backup is unreadable. If the server is compromised, the encryption does not protect. The key is kept separately, in two places |
| Never restored | They do not know whether the backups work or how long they would take. Monthly restore, on another machine |
| There is no RPO or RTO | Set them with the business. A daily backup means losing up to 24 hours |
Conclusion
In this lesson you have learned that a replica protects availability and a backup protects the data, and that you need both. You have met full, incremental, and differential backups, logical and physical ones, and point-in-time recovery. You have seen the 3-2-1 rule and why one backup must be immutable and encrypted. You have learned that the RPO and the RTO are set by the business, per data store, knowing what they cost. You have compared disaster recovery strategies, from backup and restore to active-active. And, above all, you have seen that a backup only exists once it has been restored: Verdalia had spent 22 nights saving 20-byte files.
This lesson ends Module 5. At the end of March, Verdalia had two credentials in the repository, a network where everything trusted everything, a panel open to the internet with former employees' accounts, and backups nobody had tested. The path had an order: first the principles and ADR-007; then a threat modeling session that lined up sixteen risks; then identity, data, and the network, with ADR-008; and finally the backups, with ADR-009. Scenario QS-4 is met and verified, and the day before Mother's Day, one year after the outage that opened this course, went by with 1,260 users and no incidents. The risks that remain are written down and have someone who answers for them.
But May 1 left another picture. That afternoon, Marta tried to draw the complete system for the June review set by ADR-001, and found three different diagrams: the architecture diagram from Module 4, with no zones or bastion; the data flow diagram from the threat modeling; and Lucía's network table. None was complete, and verdalia-app-04 appeared in none of them. The system has ten machines, nine ADRs, seven secrets on each application server, twelve network rules, and a 38-step setup checklist that is only run by hand. It has grown so much that nobody holds the whole of it in their head anymore. That is what Module 6 is about, and it starts at the beginning, with the lesson “Design and Modeling Tools.”
