Lab: automated backups and a timed restore
Add a managed PostgreSQL database with automated backups and a versioned bucket with lifecycle rules to the lab network, seed known data, break it, restore to a point in time in another availability zone, and prove the result with an integrity check, a permission check and a timed report against a stated RPO and RTO. Then undo an object deletion and tear everything down.
Contentsand lesson path
On this page
- Goal and setup
- How managed database backups work
- Step 1: Rehearse the integrity check offline
- Step 2: A drill log and a report that can fail
- Step 3: A database with automated backups and a versioned bucket
- Step 4: Seed known data, record the restore point, break it
- Step 5: The timed restore into the other availability zone
- Step 6: Prove the restore, then report
- Step 7: Undo an object deletion with versioning
- Step 8: Tear everything down
- Troubleshooting
- Check your understanding
- Apply it
- Review prompt
Lessons of Cloud Basics
- What you rent, what you still own, and which service to pick Concept · 25 min
- Lab: a two-tier network with public and private subnets Lab · 30 min
- Identities, roles and least-privilege policies Worked example · 20 min
- Cost as an engineering signal: tags, budgets, rightsizing and teardown Worked example · 20 min
- Lab: automated backups and a timed restore Lab · 25 min
- Check: architecture, permissions and recovery review Knowledge check · 10 questions
What you will learn
- Protect stateful data with automated backups or snapshots, object versioning and lifecycle rules, and prove recovery with a timed restore that meets a stated RPO and RTO.
Prerequisites: Networking Basics
01. Goal and setup
A backup job that reports "success" proves only that something was written somewhere. The evidence that you can recover is a timed restore: bring the data back on a new instance, check that it is the data you expected, and measure two numbers against targets agreed in advance:
- the data-loss window, compared with the RPO (recovery point objective, the most data loss you accept): the time between the restore point and the incident. Writes in that gap are gone.
- the recovery time, compared with the RTO (recovery time objective, the longest outage you accept): from the incident until a checked database is ready. In a real incident, add the time to repoint the application.
This drill uses an RPO of 15 minutes and an RTO of 60 minutes. You will seed a table, fingerprint it, simulate a bad DELETE, restore to just before it in the other AZ, and compare.
Resource contract. This lab extends the cloud-lab/ folder from lab 3, whose network and probe must be running. The same rules apply: sandbox account, one region, budget alert, Project=cloud-basics-lab tags, destroy the same day. During the restore two db.t4g.micro databases run side by side. Steps 1 and 2 are free and need no account.
You need: everything from lab 3, plus Python 3.11 or later locally. Write every time you note down in UTC, as AWS does.
cloud-lab/
├── ... lab 3 files ...
├── fingerprint.py step 1: fingerprint of a table dump (also copied to the probe)
├── rehearse.py step 1: offline rehearsal with SQLite
├── mark.sh step 2: timestamps for the drill log
├── drill_report.py step 2: data-loss window and recovery time
├── backup.tf step 3: database, backups, bucket, lifecycle rules
└── seed.sql step 4: created on the probe02. How managed database backups work
With automated backups on, Amazon RDS takes a storage snapshot once a day in the backup window, a setting separate from the maintenance window. On a Single-AZ instance, storage I/O can pause briefly while the snapshot starts; a Multi-AZ PostgreSQL instance takes it from the standby, though latency can rise for a few minutes. In between, RDS uploads the transaction logs to S3 every five minutes. A point-in-time restore creates a new instance from the snapshot before your chosen time and replays the logs up to that second, which can be any time between the earliest restorable time and LatestRestorableTime (usually about five minutes behind the present).
So the data-loss window depends on the failure. After a bad query you restore to just before it and lose only the writes made since. If the instance and its storage are lost, the newest point is LatestRestorableTime, so a few minutes of writes may be gone; a Multi-AZ standby, which receives every write synchronously, keeps that case near zero.
Backups must also sit in a different failure domain from the data. RDS keeps them in S3, outside the instance's AZ, and this lab restores into the second AZ. Surviving a regional outage needs a copy in another region; surviving a compromised account needs a copy in a separate backup account. Faster strategies cost more: a pilot light keeps data stores replicating in a second region with application servers switched off until failover, and multi-site active/active brings RTO and RPO down to seconds, limited by replication lag.
03. Step 1: Rehearse the integrity check offline
Before you pay for a database, check the tools on your own machine. fingerprint.py reads a table dump in CSV, ordered by id, and prints the row count, the highest id, the newest timestamp and a SHA-256 hash over every value of every row. Two dumps match only if every row matches, which a row count alone cannot tell you. rehearse.py uses SQLite to produce three dumps: the seeded state, a correct restore of it, and the primary after the bad DELETE.
"""Fingerprint a table dump in CSV (header first, rows ordered by id).
Prints row count, highest id, newest created_at and a SHA-256 of every row,
so two dumps match only if every value in every row matches.
"""
import csv
import hashlib
import sys
def fingerprint(lines):
reader = csv.reader(lines)
header = next(reader)
digest = hashlib.sha256()
rows, max_id, newest = 0, None, ""
for row in reader:
digest.update(("\x1f".join(row) + "\n").encode())
rows += 1
max_id = int(row[0]) if max_id is None else max(max_id, int(row[0]))
newest = max(newest, row[header.index("created_at")])
return {"rows": rows, "max_id": max_id, "newest": newest,
"sha256": digest.hexdigest()[:16]}
if __name__ == "__main__":
result = fingerprint(sys.stdin)
print(" ".join(f"{key}={value}" for key, value in result.items()))"""Rehearse the drill offline: SQLite stands in for the database.
Writes seed.csv (state at the restore point), restored.csv (what a correct
restore returns) and incident.csv (the damaged primary) for fingerprint.py.
"""
import csv
import shutil
import sqlite3
QUERY = "SELECT id, customer, amount_cents, created_at FROM orders ORDER BY id"
def dump(db_file, csv_file):
with sqlite3.connect(db_file) as con, open(csv_file, "w", newline="") as out:
writer = csv.writer(out, lineterminator="\n")
writer.writerow(["id", "customer", "amount_cents", "created_at"])
writer.writerows(con.execute(QUERY))
with sqlite3.connect("primary.db") as con:
con.execute("DROP TABLE IF EXISTS orders")
con.execute("CREATE TABLE orders (id INTEGER PRIMARY KEY, customer TEXT,"
" amount_cents INTEGER, created_at TEXT)")
con.executemany(
"INSERT INTO orders VALUES (?, ?, ?, ?)",
[(g, f"cust-{g % 50}", (g * 37) % 10000 + 100, "2026-10-30 08:00:00+00")
for g in range(1, 1001)])
dump("primary.db", "seed.csv")
shutil.copy("primary.db", "restored.db") # stands in for the point-in-time copy
with sqlite3.connect("primary.db") as con:
con.execute("DELETE FROM orders WHERE id % 10 = 0") # the incident
dump("restored.db", "restored.csv")
dump("primary.db", "incident.csv")
print("wrote seed.csv, restored.csv and incident.csv")python3 rehearse.py
for f in seed restored incident; do
python3 fingerprint.py < $f.csv > $f.txt; echo "$f: $(cat $f.txt)"
done
diff seed.txt restored.txt && echo "integrity: MATCH"
# Negative test: change one amount and keep the row count the same.
sed 's/^7,cust-7,359,/7,cust-7,358,/' seed.csv | python3 fingerprint.pywrote seed.csv, restored.csv and incident.csv
seed: rows=1000 max_id=1000 newest=2026-10-30 08:00:00+00 sha256=09d7fb5b9711bf20
restored: rows=1000 max_id=1000 newest=2026-10-30 08:00:00+00 sha256=09d7fb5b9711bf20
incident: rows=900 max_id=999 newest=2026-10-30 08:00:00+00 sha256=ac51ebe21a1ef432
integrity: MATCH
rows=1000 max_id=1000 newest=2026-10-30 08:00:00+00 sha256=7e85ca786adebb2eThe restored copy matches the seed exactly. The damaged primary differs in count and hash. The last line is the important negative test: one changed amount leaves the count, the highest id and the newest timestamp untouched, and only the hash catches it.
04. Step 2: A drill log and a report that can fail
During the drill you record five moments in drill.log with mark.sh: the restore-point you will restore to, the incident, restore-start, db-available and verified (the integrity and permission checks passed). drill_report.py turns them into the two numbers and exits with status 1 if either target is missed, so a script or CI job can act on the result. Try it now with a sample timeline (these times are made up for the rehearsal) and with a tighter RTO.
#!/usr/bin/env bash
# Usage: ./mark.sh EVENT [UTC-TIME] Appends "TIME EVENT" to drill.log.
set -euo pipefail
when="${2:-$(date -u +%Y-%m-%dT%H:%M:%SZ)}"
echo "$when $1" | tee -a drill.log"""Turn drill.log into the achieved data-loss window and recovery time.
Usage: python3 drill_report.py drill.log RPO_MINUTES RTO_MINUTES
Exits 0 when both targets are met and 1 when either is missed.
"""
import sys
from datetime import datetime
NEEDED = ["restore-point", "incident", "restore-start", "db-available", "verified"]
def load(path):
events = {}
with open(path) as log:
for line in log:
when, name = line.split()
events[name] = datetime.fromisoformat(when.replace("Z", "+00:00"))
missing = [name for name in NEEDED if name not in events]
if missing:
sys.exit(f"drill.log is missing: {', '.join(missing)}")
return events
def minutes(e, start, end):
return (e[end] - e[start]).total_seconds() / 60
def main(path, rpo, rto):
e = load(path)
loss = minutes(e, "restore-point", "incident")
recovery = minutes(e, "incident", "verified")
restore = minutes(e, "restore-start", "db-available")
checks = minutes(e, "db-available", "verified")
print(f"restore, start to available {restore:5.1f} min")
print(f"checks, available to verified {checks:5.1f} min")
for label, value, target in [("data-loss window", loss, rpo),
("recovery time", recovery, rto)]:
verdict = "MET" if value <= target else "MISSED"
print(f"{label:<29} {value:5.1f} min target {target:g} {verdict}")
return 0 if loss <= rpo and recovery <= rto else 1
if __name__ == "__main__":
sys.exit(main(sys.argv[1], float(sys.argv[2]), float(sys.argv[3])))chmod +x mark.sh && rm -f drill.log
./mark.sh restore-point 2026-10-30T08:12:05Z
./mark.sh incident 2026-10-30T08:12:40Z
./mark.sh restore-start 2026-10-30T08:20:10Z
./mark.sh db-available 2026-10-30T08:41:55Z
./mark.sh verified 2026-10-30T08:47:30Z
python3 drill_report.py drill.log 15 60; echo "exit=$?"
python3 drill_report.py drill.log 15 20; echo "exit=$?"
rm drill.log # start the real drill with an empty log2026-10-30T08:12:05Z restore-point
2026-10-30T08:12:40Z incident
2026-10-30T08:20:10Z restore-start
2026-10-30T08:41:55Z db-available
2026-10-30T08:47:30Z verified
restore, start to available 21.8 min
checks, available to verified 5.6 min
data-loss window 0.6 min target 15 MET
recovery time 34.8 min target 60 MET
exit=0
restore, start to available 21.8 min
checks, available to verified 5.6 min
data-loss window 0.6 min target 15 MET
recovery time 34.8 min target 20 MISSED
exit=105. Step 3: A database with automated backups and a versioned bucket
Add backup.tf to cloud-lab/. The database sits in the private subnets with only the lab-db group. manage_master_user_password has RDS generate the password and keep it in Secrets Manager, so nothing secret appears in your files; the probe's role may read exactly that one secret.
The bucket has versioning, so an overwrite or delete keeps the previous version, and a lifecycle rule so versions do not pile up: a replaced version expires after 30 days, but the rule never expires the three newest replaced versions of an object. The rule also removes orphaned delete markers and abandoned multipart uploads.
Three settings are lab-only so that one tofu destroy removes everything: no deletion protection, no final snapshot, and force_destroy on the bucket. In production, set deletion_protection = true, keep a final snapshot and protect the bucket with lifecycle { prevent_destroy = true }.
resource "aws_db_subnet_group" "private" {
name = "lab-db"
subnet_ids = aws_subnet.private[*].id # two AZs, as RDS requires
}
resource "aws_db_instance" "orders" {
identifier = "lab-orders"
engine = "postgres"
engine_version = "16" # major only; minor versions auto-upgrade
auto_minor_version_upgrade = true
instance_class = "db.t4g.micro"
allocated_storage = 20
storage_type = "gp3"
storage_encrypted = true
username = "orders_admin"
manage_master_user_password = true # password lives in Secrets Manager
db_subnet_group_name = aws_db_subnet_group.private.name
vpc_security_group_ids = [aws_security_group.db.id]
availability_zone = local.azs[0]
publicly_accessible = false
multi_az = false # lab cost; production: true
backup_retention_period = 7 # days of snapshots and logs
backup_window = "16:00-16:30" # UTC
maintenance_window = "sun:17:00-sun:17:30" # UTC, no overlap
copy_tags_to_snapshot = true
apply_immediately = true
# Lab only, so that one destroy removes everything. In production set
# deletion_protection = true and keep a final snapshot.
deletion_protection = false
skip_final_snapshot = true
}
data "aws_iam_policy_document" "read_db_secret" {
statement {
actions = ["secretsmanager:GetSecretValue"]
resources = [aws_db_instance.orders.master_user_secret[0].secret_arn]
}
}
resource "aws_iam_role_policy" "probe_read_db_secret" {
name = "read-db-secret"
role = aws_iam_role.probe.id
policy = data.aws_iam_policy_document.read_db_secret.json
}
resource "aws_s3_bucket" "backups" {
bucket_prefix = "cloud-basics-backups-"
force_destroy = true # lab only: lets destroy delete every version
}
resource "aws_s3_bucket_versioning" "backups" {
bucket = aws_s3_bucket.backups.id
versioning_configuration {
status = "Enabled"
}
}
resource "aws_s3_bucket_lifecycle_configuration" "backups" {
bucket = aws_s3_bucket.backups.id
depends_on = [aws_s3_bucket_versioning.backups]
rule {
id = "bound-old-versions"
status = "Enabled"
filter {} # every object in the bucket
noncurrent_version_expiration {
noncurrent_days = 30
newer_noncurrent_versions = 3
}
expiration {
expired_object_delete_marker = true
}
abort_incomplete_multipart_upload {
days_after_initiation = 7
}
}
}
output "db_address" { value = aws_db_instance.orders.address }
output "db_secret_arn" {
value = aws_db_instance.orders.master_user_secret[0].secret_arn
}
output "restore_az" { value = local.azs[1] }
output "backup_bucket" { value = aws_s3_bucket.backups.bucket }tofu plan -out backup.tfplan
tofu apply backup.tfplanPlan: 6 to add, 0 to change, 0 to destroy.
...
aws_db_instance.orders: Still creating... [5m0s elapsed]
...
Apply complete! Resources: 6 added, 0 changed, 0 destroyed.
...
backup_bucket = "cloud-basics-backups-20261030081500000000000001"
db_address = "lab-orders.abcdefghijkl.ap-southeast-1.rds.amazonaws.com"
db_secret_arn = "arn:aws:secretsmanager:ap-southeast-1:123456789012:secret:rds!db-…"
restore_az = "ap-southeast-1b"06. Step 4: Seed known data, record the restore point, break it
Open a Session Manager shell on lab-probe as in lab 3. The session starts as ssm-user in /usr/bin, where that user cannot write files, so the first command moves to the home directory. Install the PostgreSQL client, read the password from the secret and set the psql variables, pasting your own db_address and db_secret_arn outputs. Keep the ARN in single quotes: it contains !, which bash would otherwise expand.
Then create seed.sql and fingerprint.py on the probe (paste each between cat > name <<'EOF' and a closing EOF line). The seed creates 1,000 orders and an application role, so you can check permissions after the restore as well as rows.
cd ~ # sessions start in /usr/bin, which ssm-user cannot write to
sudo dnf install -y postgresql16
export AWS_REGION=ap-southeast-1 # your lab region
SECRET_ARN='arn:aws:secretsmanager:...:secret:rds!db-...' # db_secret_arn
export PGHOST=lab-orders.xxxx.rds.amazonaws.com # db_address
export PGUSER=orders_admin PGDATABASE=postgres PGSSLMODE=require PGTZ=UTC
export PGPASSWORD="$(aws secretsmanager get-secret-value \
--secret-id "$SECRET_ARN" --query SecretString --output text \
| python3 -c 'import json, sys; print(json.load(sys.stdin)["password"])')"
psql -Atc 'SELECT version()'CREATE TABLE orders (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
customer text NOT NULL,
amount_cents integer NOT NULL CHECK (amount_cents > 0),
created_at timestamptz NOT NULL DEFAULT now()
);
INSERT INTO orders (customer, amount_cents)
SELECT 'cust-' || (g % 50), (g * 37) % 10000 + 100
FROM generate_series(1, 1000) AS g;
CREATE ROLE orders_app NOLOGIN;
GRANT SELECT, INSERT ON orders TO orders_app;
SELECT count(*) AS seeded_rows FROM orders;psql -v ON_ERROR_STOP=1 -f seed.sql
DUMP='SELECT id, customer, amount_cents, created_at FROM orders ORDER BY id'
psql --csv -c "$DUMP" | python3 fingerprint.py | tee good.txt
date -u +%Y-%m-%dT%H:%M:%SZ # note it: the restore point
sleep 5
psql -c 'DELETE FROM orders WHERE id % 10 = 0' # the incident
date -u +%Y-%m-%dT%H:%M:%SZ # note it: the incident timePostgreSQL 16.x on aarch64-unknown-linux-gnu, compiled by gcc ...
CREATE TABLE
INSERT 0 1000
CREATE ROLE
GRANT
seeded_rows
-------------
1000
(1 row)
rows=1000 max_id=1000 newest=2026-10-30 08:11:58.412345+00 sha256=…
2026-10-30T08:12:05Z
DELETE 100
2026-10-30T08:12:40Z07. Step 5: The timed restore into the other availability zone
On your own machine, in cloud-lab/, log the two times you noted (replace the sample times below with yours). Then run the describe-db-instances query every minute until LatestRestorableTime is later than your restore point, usually within five minutes. A real recovery waits for this too, which is why the clock starts at the incident.
The restore creates a new instance, lab-orders-restored, in the second AZ with the lab-db group; without --vpc-security-group-ids it would get the VPC's default group and the probe could not reach it. The command sets the lab's Project and Environment tags explicitly rather than relying on RDS to copy them from the source, so the teardown check will find the instance if you forget it. The waiter gives up after 30 minutes, so the loop calls it up to three times.
./mark.sh restore-point 2026-10-30T08:12:05Z # your noted times
./mark.sh incident 2026-10-30T08:12:40Z
aws rds describe-db-instances --db-instance-identifier lab-orders \
--query 'DBInstances[0].LatestRestorableTime' --output text
./mark.sh restore-start
aws rds restore-db-instance-to-point-in-time \
--source-db-instance-identifier lab-orders \
--target-db-instance-identifier lab-orders-restored \
--restore-time 2026-10-30T08:12:05Z \
--db-subnet-group-name lab-db \
--vpc-security-group-ids "$(tofu output -raw db_sg_id)" \
--availability-zone "$(tofu output -raw restore_az)" \
--db-instance-class db.t4g.micro --no-publicly-accessible \
--tags Key=Project,Value=cloud-basics-lab Key=Environment,Value=ephemeral \
--query 'DBInstance.DBInstanceStatus' --output text
for attempt in 1 2 3; do
aws rds wait db-instance-available \
--db-instance-identifier lab-orders-restored && break
done
./mark.sh db-available
aws rds describe-db-instances --db-instance-identifier lab-orders-restored \
--query 'DBInstances[0].[Endpoint.Address,AvailabilityZone]' --output text2026-10-30T08:12:05Z restore-point
2026-10-30T08:12:40Z incident
2026-10-30T08:16:02+00:00
2026-10-30T08:20:10Z restore-start
creating
2026-10-30T08:41:55Z db-available
lab-orders-restored.abcdefghijkl.ap-southeast-1.rds.amazonaws.com ap-southeast-1b08. Step 6: Prove the restore, then report
On the probe, point PGHOST at the restored endpoint. The restored database holds the master password that was valid at the restore point, so the same credentials work; it is not linked to a Secrets Manager secret, so in a real recovery you would turn on managed credentials before applications use it. Run three checks:
- Integrity: the fingerprint must equal
good.txtexactly. - Permissions: the application role must still hold its privileges.
- Writable: an insert must succeed; the new id can be any number above 1000, because PostgreSQL may skip sequence values after recovery.
export PGHOST=lab-orders-restored.xxxx.rds.amazonaws.com # restored endpoint
psql --csv -c "$DUMP" | python3 fingerprint.py | tee restored.txt
diff good.txt restored.txt && echo "integrity: MATCH"
psql -Atc "SELECT has_table_privilege('orders_app', 'orders', 'SELECT')
AND has_table_privilege('orders_app', 'orders', 'INSERT')"
psql -Atc "INSERT INTO orders (customer, amount_cents) VALUES ('drill', 1)
RETURNING id"rows=1000 max_id=1000 newest=2026-10-30 08:11:58.412345+00 sha256=…
integrity: MATCH
t
1001
INSERT 0 1./mark.sh verified
python3 drill_report.py drill.log 15 60; echo "exit=$?"2026-10-30T08:47:30Z verified
restore, start to available 21.8 min
checks, available to verified 5.6 min
data-loss window 0.6 min target 15 MET
recovery time 34.8 min target 60 MET
exit=0Keep drill.log, both fingerprint files and the report: they are the evidence the skill practice asks for. A MISSED target is a result, not a broken lab. Look at where the minutes went (waiting for LatestRestorableTime, the restore, your checks) and either change the design, for example to Multi-AZ or a warm standby, or agree a realistic target. Also, "available" is not "warm": a restored volume loads blocks from S3 in the background, so first queries can be slow.
09. Step 7: Undo an object deletion with versioning
On your machine, upload a file, overwrite it with a bad copy, and delete it. With versioning, a delete only adds a delete marker on top of the versions. Removing the marker brings back the latest version; copying an older version over the key brings back the good copy. Versions[-1] is the oldest version, because S3 lists the versions of a key newest first.
BUCKET=$(tofu output -raw backup_bucket); KEY=reports/daily.csv
echo "good copy" > daily.csv && aws s3 cp daily.csv "s3://$BUCKET/$KEY"
echo "bad copy" > daily.csv && aws s3 cp daily.csv "s3://$BUCKET/$KEY"
aws s3 rm "s3://$BUCKET/$KEY"
aws s3api list-object-versions --bucket "$BUCKET" --prefix "$KEY" \
--query '{markers: DeleteMarkers[].IsLatest, versions: length(Versions)}'
MARKER=$(aws s3api list-object-versions --bucket "$BUCKET" --prefix "$KEY" \
--query 'DeleteMarkers[?IsLatest].VersionId' --output text)
aws s3api delete-object --bucket "$BUCKET" --key "$KEY" --version-id "$MARKER"
aws s3 cp "s3://$BUCKET/$KEY" -
GOOD=$(aws s3api list-object-versions --bucket "$BUCKET" --prefix "$KEY" \
--query 'Versions[-1].VersionId' --output text)
aws s3api copy-object --bucket "$BUCKET" --key "$KEY" \
--copy-source "$BUCKET/$KEY?versionId=$GOOD" --output text --query VersionId
aws s3 cp "s3://$BUCKET/$KEY" -delete: s3://cloud-basics-backups-.../reports/daily.csv
{
"markers": [
true
],
"versions": 2
}
{
"DeleteMarker": true,
"VersionId": "EXAMPLEmarkerVersionId"
}
bad copy
EXAMPLEnewVersionId
good copyThe lifecycle rule from step 3 will expire the replaced versions after 30 days, keeping the newest three. Versioning protects against overwrites and deletes made through normal calls, not against someone allowed to delete versions or the bucket itself. For that, keep a copy in another account or region, and consider S3 Object Lock, which in compliance mode stops anyone, administrators included, from deleting or overwriting a locked version before its retention date.
10. Step 8: Tear everything down
Order matters. lab-orders-restored was created by the CLI, so OpenTofu does not know it exists: tofu destroy would leave it running, and would fail to delete the subnet group and security group it still uses. Delete it first, then destroy the stack (27 resources from lab 3 plus 6 from this lab), then confirm that nothing tagged for the lab and no retained automated backup is left.
aws rds delete-db-instance --db-instance-identifier lab-orders-restored \
--skip-final-snapshot --delete-automated-backups --query 'DBInstance.DBInstanceStatus'
aws rds wait db-instance-deleted --db-instance-identifier lab-orders-restored
tofu destroy
aws resourcegroupstaggingapi get-resources \
--tag-filters Key=Project,Values=cloud-basics-lab \
--query 'ResourceTagMappingList[].ResourceARN'
aws rds describe-db-instance-automated-backups \
--query 'DBInstanceAutomatedBackups[].DBInstanceIdentifier'"deleting"
Destroy complete! Resources: 33 destroyed.
[]
[]11. Troubleshooting
12. Check your understanding
13. Apply it
For the skill practice, run the drill against the service you deploy, not a seeded table:
- Fingerprint records that matter to the application, and check the application's own database user and grants on the restored copy.
- Repoint the app at the restored endpoint and include that time in the RTO.
- Move the failure domain further: replicate automated backups or copy a snapshot to another region, and time a restore there.
- Schedule the drill and keep every run's
drill.logand report, so a slowing restore shows up as a trend.
14. Review prompt
Without looking back, explain how point-in-time recovery uses snapshots and transaction logs, why a restore always creates a new instance, and what limits the data-loss window after a bad query compared with after losing the instance. List the five events in the drill log and which pairs give the two numbers. Then say what versioning and the lifecycle rule each protect against, and what they do not.
References
- Amazon RDS: introduction to backups
- Amazon RDS: managing automated backups (backup window)
- Amazon RDS: restoring a DB instance to a specified time
- AWS CLI reference: restore-db-instance-to-point-in-time
- Amazon RDS: password management with Secrets Manager
- Amazon S3: restoring previous versions
- Terraform AWS provider: aws_s3_bucket_lifecycle_configuration
- Terraform AWS provider: aws_db_instance
- Disaster Recovery of Workloads on AWS: disaster recovery options in the cloud
Your progress
Reading state
Sign in to save that you finished reading this lesson.
Prove this skill
10 questions · about 8 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.