Chapter 14: EC2 Operations — Elastic IP, AMI, Snapshots and Vertical Scaling
14.3 EBS snapshots in practice
In short: A snapshot is a point-in-time, incremental backup of an EBS volume: the first copies all used blocks, later ones only changed blocks.
Quick recap
Friends, in Chapter 13 we learnt what a snapshot is; now let's use it in real work – recovering one file, copying to another region, and automatic backups.
मित्रांनो, Chapter 13 मध्ये स्नॅपशॉट काय आहे ते शिकलो; आता खऱ्या कामात वापरूया – एक फाइल परत मिळवणं, दुसऱ्या रीजनमध्ये कॉपी, आणि ऑटोमॅटिक बॅकअप्स.
दोस्तों, Chapter 13 में हमने सीखा कि स्नैपशॉट क्या है; अब असली काम में इस्तेमाल करते हैं – एक फ़ाइल वापस पाना, दूसरे रीजन में कॉपी, और ऑटोमैटिक बैकअप्स.
- A snapshot is a point-in-time, incremental backup of an EBS volume: the first copies all used blocks, later ones only changed blocks.
- Snapshots are stored in Amazon S3, managed by AWS — you don't see them in your S3 buckets.
- For a standard Regional snapshot, create the restored volume in the recovery instance’s AZ. Use a destination copy for cross-Region restore when required. Local Zones and Outposts have specific destination rules.
Create a snapshot of a volume
EC2 → Elastic Block Store → Volumes → select the volume (check the Attached resources column) → Actions → Create snapshot → description web-1-root-before-upgrade → tag Name → Create snapshot. Watch it under Snapshots until Completed. (Or from the instance's Storage tab → click the volume ID.)
aws ec2 create-snapshot --volume-id vol-0123456789abcdef0 --description "web-1-root-before-upgrade"
Consistency
Snapshots capture written volume data. Coordinate application writes with its supported backup procedure and choose all required volumes. AWS recommends a stopped instance for a root-volume snapshot. A filesystem flush alone does not establish application or multi-service consistency.
Create a volume from a snapshot and mount it (file restore)
Scenario: a student accidentally deleted /var/www/mysite/index.html. We restore just that file from last night's snapshot without touching the running server.
Step 1 — Create volume: Snapshots → select the snapshot → Actions → Create volume from snapshot → type gp3 → size (same or larger) → Availability Zone = same as the instance you will attach to → Create volume.
Step 2 — Attach: Volumes → select the new volume → Actions → Attach volume → instance → device /dev/sdg → Attach.
Step 3. On an isolated recovery host, identify the new volume and its actual guest partition and filesystem. Use the documented inspection or mount options for that filesystem. A restored volume retains data. Keep formatting operations away from it. Verify the intended file in a separate staging path before publishing anything.
Step 4. After validating the precise copy, unmount, detach and remove the specific temporary volume only if the lab owner has finished with it.
Full restore of a broken root volume
Choose a supported root recovery workflow for the intended instance. EC2’s managed root-volume replacement requires a supported running EBS-backed instance and reboots it during the task. If you use a snapshot, it must be taken directly from a current or former root volume of that instance. Reattaching a root volume on a stopped instance or launching a separate AMI is a distinct procedure.
Copy a snapshot to another region
Copy a completed snapshot to the intended Region using the documented Snapshot action. Record the destination ID and key settings. For a recovery set, verify each required member copy and test the mounted data in the destination.
Create an AMI from a snapshot
For a snapshot of a root volume: select it → Actions → Create image from snapshot → name → architecture (must match the original, e.g. x86_64) → root device name (e.g. /dev/xvda) → virtualization hvm → boot mode (as the original) → Create image. You can then launch instances from it. (Creating the AMI from the instance, as in 14.2, is easier because AWS fills these details automatically.)
Automate snapshots with Amazon Data Lifecycle Manager
Use a lifecycle policy that matches the source inventory and recovery schedule. Verify the actual snapshots it creates, and periodically restore a test copy to prove the point is useful.
- Tag the volumes (or instances) to protect, e.g.
Backup = daily. - EC2 → Elastic Block Store → Lifecycle Manager → Create lifecycle policy.
- Policy type EBS snapshot policy (or EBS-backed AMI policy to create AMIs) → target resource type Volume (or Instance) → target tag
Backup = daily. - IAM role: Default role → policy status Enabled.
- Schedule: e.g. every 24 hours starting at 03:00 UTC (08:30 IST) → retention type Count → keep 7 → optionally copy tags, enable cross-region copy.
- Create policy. After the scheduled window, check the source IDs, completed snapshot states and expected policy ownership. Watch for explicit failures and rehearse restoring the data.
(AWS Backup is the broader, multi-service alternative used in many companies.)
Delete old snapshots
Check the exact snapshot, retention policy and dependencies before deletion. EC2 prevents normal deletion of a snapshot used as the root device of a registered AMI. AWS Backup-managed recovery points have their own deletion procedure. EBS preserves blocks still referenced by retained snapshots.
Ravindra Bagale's Tip
Identify the exact restored volume and its filesystem first. Preserve its data, check the documented filesystem recovery options, and stage any recovered file separately before applying it.
Ravindra Bagale's Tip – मराठी
Restore झालेला नेमका volume आणि filesystem आधी तपासा. त्यातील data जतन करा, योग्य filesystem recovery options वापरा आणि file थेट बदलण्याआधी staging मध्ये तपासा.
Ravindra Bagale's Tip – हिंदी
पहले सही restored volume और filesystem पहचानें। डेटा सुरक्षित रखें, उसी filesystem की recovery प्रक्रिया देखें और file लागू करने से पहले अलग staging में जाँचें।
Lab
खालील offline lab मध्ये आधीची HTML file staging ला आणा. मग वाचता येणारी database copy आणि योग्य recovery point वेगळे तपासा. Stock आणि delivery record जुळल्यावरच restore स्वीकारा.
Got it? A snapshot is not just a backup – from it you get back one file, a whole disk or a new AMI. Now let's move on to making the server bigger.
समजलं का? स्नॅपशॉट म्हणजे फक्त बॅकअप नाही – त्यातून एक फाइल, पूर्ण डिस्क किंवा नवीन AMI परत मिळते. आता पुढे जाऊया सर्व्हर मोठा करायला.
समझ आया? स्नैपशॉट सिर्फ़ बैकअप नहीं है – उससे एक फ़ाइल, पूरी डिस्क या नई AMI वापस मिलती है. अब आगे चलते हैं सर्वर बड़ा करने.
Recover a file and check the records that belong with it
The warehouse team changed its inventory application in the morning. By lunch it notices that the web page lost yesterday's labels and some item counts are wrong. A teammate says the nightly EBS snapshot exists, so recovery should be easy. Start by asking what the team needs back. The answer may be one old HTML file, an entire filesystem, a coordinated set of database data and logs, or an approved earlier database record. Each outcome creates different choices. Replacing a whole production disk to retrieve one small file could unnecessarily lose new work.
Amazon EBS supplies volumes that an EC2 instance can use like block devices. A block device stores chunks of data. The operating system's filesystem organizes those blocks into files and directories. An EBS snapshot captures the point-in-time written state of a selected volume. When Amazon EBS creates a volume from that snapshot, the new volume starts with the captured volume contents. The snapshot isn't a directory you browse in the S3 console. AWS manages that backing storage. Use the supported snapshot, volume and recovery tools to work with the data.
In the simplest case, yesterday's snapshot contains a correct copy of the page. Create a separate restored volume, attach it to an authorized recovery machine, identify and inspect the filesystem, and copy the one checked file to a separate staging location. Compare it with the intended version. Publishing that file is a separate controlled change. If the problem is with business records, check the actual database and expected record values before deciding what to promote. An intact filesystem can still contain an unwanted state or capture before the change you hoped to recover.
A recovery time objective describes how soon you need useful service again. A recovery point objective describes how much recent data you can afford to lose. These come from your workload. A daily snapshot may suit one rarely changed directory while falling short for payments or rapidly updated inventory. Document which timestamps count, how you retain newer legitimate changes, and how you measure the time to restore and check the whole applicable service. The local lab demonstrates this distinction with small fabricated records. It makes no changes to EBS or an existing database.
Understand incremental storage without assuming a fragile backup chain
The first snapshot of a volume in the ordinary example stores data blocks used on that volume. Later snapshots incrementally store changed blocks according to EBS's snapshot behavior. Each retained snapshot still provides the information to restore the volume's captured point in time. The user selects one snapshot ID for the desired recovery. They do not download and replay a sequence of previous snapshots one by one. This is why you should describe the storage optimization separately from how a restore chooses its recovery point.
To see the difference, imagine a tiny volume with three written blocks named A, B and C. At the first capture they contain the values 1, 2 and 3. Before a second capture only B changes to 9. The logical second restore still needs A as 1, B as 9 and C as 3. A storage system can share A and C between retained recovery points. Deleting the first snapshot won't remove blocks that remain needed by the second. If a block from the first snapshot is referenced only by it, the storage for that block can be removed on deletion. This is a conceptual illustration, not a charge calculator or a representation of an AWS block layout.
The consequence for cost is that deleting an old snapshot need not free all the apparent size of its volume. Snapshot billing is based on data stored. Shared blocks still needed for later retained snapshots are preserved. Separately consider snapshot copies, archives where applicable, initialization options, and the new volumes or instances used to restore. An EBS volume still has its own cost while the lab retains it. Review current service pricing and actual retention rather than estimating the savings only from a list of volume sizes.
For standard Regional snapshots, a recovery volume can be created in an appropriate Availability Zone within that Region. The new volume itself belongs to a single AZ and must match the instance's AZ to attach. A cross-Region recovery ordinarily needs a snapshot copy in the destination before creating its volume there. Local Zone and Outposts options can have different snapshot destination rules. Use the verified rules for that location instead of assuming every snapshot can go anywhere. An Availability Zone mismatch during attachment is a scope error, not an indication that the snapshot's files are broken.
Choose the point in time around real application writes
Picture an inventory program recording a delivery. It updates the current count and adds a ledger entry explaining the increase. Those two values must agree after recovery. If the application has multiple files, volumes or data services, beware of capturing related pieces at different moments. A file can be fully readable and still disagree with another file from later in a transaction. The snapshot service captures blocks written to the selected volume. It doesn't understand what the warehouse means by an accepted delivery.
A single-volume snapshot is created asynchronously. The returned request or initial pending status does not mean all snapshot data has been transferred. A snapshot includes the data already written at the intended point in time, while buffered changes in the application or OS are outside that recorded state. AWS describes when writes can resume after the captured operation enters pending, if the documented prerequisites are met. Reconcile that guidance with your application's backup procedure. Some workloads need coordinated steps to produce a meaningful business state across related files or external resources.
Pause writes, use supported quiesce or transaction mechanisms, or use the application's documented backup interface where appropriate. Quiescing means bringing the application or filesystem to a known coordinated pause. A generic filesystem flush can move some cached writes to disk. It does not decide whether an in-progress user transaction was complete or whether the external ledger was captured at the same point. For a root-volume snapshot AWS recommends stopping the source instance to obtain a consistent capture, subject to the workload's maintenance and access plan. A bound source that must keep running requires a deliberate crash-consistency and restore-testing decision.
For an EC2 workload spread across attached EBS volumes, a multi-volume snapshot set can capture the included volumes as a coordinated crash-consistent group. Specify all needed volumes and record the relationship in the plan. A set can still exclude a required disk if your input did so. App consistency may require extra coordination even with included volumes. Write down what external systems participated and what was outside the set. For example, a database on a different host or a remote file service has its own backup path. A storage operation for one EC2 instance does not capture every dependency that application reads.
Capture timing matters when rebuilding after a mistaken deletion. Suppose the nightly snapshot was requested at 02:00, the correct page was modified at 09:00, and it was accidentally removed at 13:00. The nighttime snapshot can recover the captured 02:00 copy. The later change may exist in version control, another backup or a separately managed data source. Compare dates, content checksums and an application record before overwriting something. The code exercise shows the same point with a snapshot-like local backup that retains one accepted change while the source later makes another.
Restore to a separate volume and identify its actual filesystem
On an approved disposable AWS lab, begin with the source volume ID and timestamp you intend to protect. Check the Region, source instance attachment, device role and data you need. Choose the block or application capture method before writing any AWS request. The Snapshot view in EC2 can create a snapshot from the known Volume. If you use a script, explicitly select the intended profile and Region and record the ID returned by the create operation. A different tag name does not correct a mistaken source ID. Use a separate read-only description to confirm which volume produced it and whether it completed.
When a restore is needed, select the correct available snapshot. Create a new volume in the recovery instance's Availability Zone with supported size, type, encryption and performance settings. Its size must be at least the source snapshot volume size under the documented restore rules. The new volume can be independent from the source and should be identified as such in the inventory. Creating the restored volume does not overwrite the source. Add it to a dedicated recovery host or an intentionally isolated recovery environment according to your team's plan.
After attachment, check which block device and partition represent the new volume on the guest. Read both the EC2 attachment view and the guest block-device list. On Nitro a requested attachment name like /dev/sdg can appear under an NVMe name. Check the EBS volume ID using the documented identification method and verify the partition and filesystem before proceeding. A block device might be a complete filesystem or hold partitions, LVM or another storage arrangement. The device node from another student's screenshot is not a safe substitute. Start with read-only inspection commands such as these on the correct authorized Linux recovery host:
lsblk -o NAME,SIZE,TYPE,FSTYPE,UUID,MOUNTPOINTS
findmnt --target "$known_recovery_path"
The first command shows which devices and filesystems exist. The second tells you what filesystem serves the specified path, which may still be the root filesystem before the new device is mounted there. Read the column for the observed mount point and match it with the expected filesystem. Select the filesystem's appropriate mount or recovery procedure. A restored volume already contains data and generally already has a filesystem. Formatting it would destroy the very data you are trying to examine.
Read-only access is useful for isolating a recovery, but the safe options depend on the filesystem and its state. With ext4, a plain read-only mount can still replay its journal. For an appropriate clean recovery copy and a case that needs journal replay disabled, kernel documentation describes a no-load option. With XFS, a duplicate filesystem UUID can require the documented nouuid mount option on the recovery copy. XFS also has a documented no-recovery option that requires read-only mount. A no-recovery view of an unclean filesystem may be inconsistent. Follow the actual filesystem documentation or supported recovery process. When recovery requires writes, use a working copy and keep a verified original recovery point.
Once the intended product file or database is verified, copy it to a separate staging area. Compare the timestamp, checksum and exact expected values. Review access modes and ownership before serving it. If only one file was accidentally removed, copy that approved recovered file into the intended release through its normal deployment method. Leave other newer files and unrelated sites as they were. If database repair needs selected historical records, follow the engine's appropriate merge and validation process. An application reading an old full copy can discard good newer data even when that copy is authentic.
When you finish, unmount the isolated copy before detaching it. Check that the target volume has no remaining use and that a retained snapshot or verified backup covers your recovery objective. If you must keep a working restored volume for a test, record its intended lifecycle and cost. Cleanup should identify the exact new volume ID and only the resources you created for this operation. A region-wide cleanup based on age alone has no way to determine what data a team still needs.
Choose file recovery, root recovery or a new instance
If you only need an HTML file, the separate volume inspection usually has less impact than switching the main root volume. A damaged root filesystem or guest configuration can instead require restoring a compatible root device or launching a replacement. These choices change which resources and addresses remain involved. The earlier AMI lesson describes registration and testing for a separate instance.
EC2 offers a managed root-volume replacement task for supported running instances with an EBS root volume. The instance is automatically rebooted during the task. Where a snapshot is chosen, it must come directly from a current or previous root volume of that same instance. A copy of such a snapshot does not meet that particular task's snapshot rule. There are also documented constraints on compatible AMI and launch-state sources. Check the current capacity, task prerequisites and access impact before choosing it. An in-place root change and an app replacement on another instance have different operational boundaries.
Manually attaching a different root volume to a stopped machine is a separate supported workflow with its own device naming and scope requirements. Record the old root volume and keep it if the recovery plan depends on it. Confirm that the restored root supports the instance's boot and driver requirements. Then check boot, data attachments and real application behavior. A successful file copy from a volume does not prove a new root will boot. Similarly, a machine that boots from an earlier root may still use a database with newer or incompatible state. Make compatibility and business acceptance explicit.
Initialization may also matter to your recovery time target. A volume created from a snapshot may experience slower initial I/O while blocks are loaded. AWS provides documented choices such as fast snapshot restore where supported and an optional provisioned initialization rate for applicable volumes. Availability and cost depend on the chosen settings. Measure the time for your actual data and app workflow. A volume that the service labels available still needs mounting, evidence checks and any agreed recovery performance tests.
Retain verified recovery points rather than counting files
Use a schedule that matches the workload's recovery goal. Amazon Data Lifecycle Manager can create, retain and remove the EBS snapshots or EBS-backed AMIs that its policies manage. Choose the target resources, commonly using documented tag rules, and the retention criteria. AWS Backup provides a different broader service for supported resources and recovery points. Choose one or more based on the required ownership, retention, copy and restore design. A daily policy configured on the wrong tag can make all its schedule settings correct while protecting none of the intended volumes.
Verify that the intended source volumes actually produced recent completed recovery points. Learn how your operator sees a failed snapshot, misses a volume because it was newly added, or notices an incomplete cross-Region set. For a multi-volume capture keep the IDs and their grouped purpose. To copy a multi-volume set through the documented copy process, identify the member snapshots and copy each as required. A destination transfer can preserve only what it actually included. Check the destination IDs and encryption, and test a restore in its intended Region or account.
Snapshots from encrypted EBS volumes automatically retain encryption with that volume's KMS key at snapshot creation. Copy and restored-volume settings have their own key and account rules. Ensure your recovery role can use the intended key and the backup is visible to that role. Copying a backup to another Region does not automatically solve a missing key policy or select the correct guest network. Prepare those elements as part of a test restore rather than discovering them during an incident. Treat key retention as part of the data recovery policy.
Before deleting a snapshot, check dependencies and retention ownership. A snapshot used as the root device backing a registered AMI can't be deleted through normal EC2 snapshot deletion while that registration prevents it. A snapshot managed by AWS Backup needs to follow its service's recovery point procedure. Some retained recovery points may be covered by applicable Recycle Bin rules. Other existing volumes already created from the snapshot are independent of deleting it. Don't treat a successful test restore or lower displayed storage use as authorization to discard the approved source snapshot.
Lab: compare a readable copy with an application-verified recovery point
Use Python 3 with its standard SQLite module and an ordinary Bash shell. You'll create one text file and a tiny database in a private temporary directory. The exercise shows a failure that a basic file check can miss: a copied database file can open and pass an integrity check even when the copy missed expected committed changes. The example includes a separate backup produced by SQLite's documented online backup API. SQLite is the local teaching database, and an EBS snapshot of a volume has different capture mechanics. This is a model of why you should check application consistency and the requested point in time.
SQLite can use a write-ahead log, or WAL, to store committed changes before copying them back to the main database file. A checkpoint transfers eligible changes from the WAL back into the main file. In the demonstration, one connection stays open and automatic checkpointing is disabled. We arrange one change so it remains in the WAL. A deliberately incomplete file copy then misses it. Do not copy a running database this way to make a real recovery point. For another database engine, follow the corresponding supported consistency and backup procedure.
Step 1. Create an isolated source and separate recovery area
set -eu
command -v python3 >/dev/null
umask 077
snap_lab=$(mktemp -d /tmp/rb-ebs-rehearse.XXXXXX)
snap_cleanup() {
case "$snap_lab" in
/tmp/rb-ebs-rehearse.??????) rm -rf -- "$snap_lab" ;;
esac
}
trap snap_cleanup EXIT
mkdir "$snap_lab/source" "$snap_lab/captured" "$snap_lab/restored"
printf '%s\n' 'Warehouse catalog at the earlier release' > "$snap_lab/source/index.html"
cp "$snap_lab/source/index.html" "$snap_lab/captured/index.html"
printf '%s\n' 'Warehouse catalog at the newer release' > "$snap_lab/source/index.html"
cp "$snap_lab/captured/index.html" "$snap_lab/restored/index.html"
cmp "$snap_lab/captured/index.html" "$snap_lab/restored/index.html"
if cmp -s "$snap_lab/source/index.html" "$snap_lab/restored/index.html"; then exit 1; fi
printf 'Staged the earlier page without replacing the updated source.\n'
The staged file reproduces the earlier release bytes without editing the current source file. A matching comparison with the captured copy proves one thing. A second comparison with the running source confirms that no current file was overwritten. In an AWS restore the temporary volume and operating system would provide access to those bytes. Here ordinary directories represent the separation between source, captured data and a restored staging location. The exercise uses known names so you can verify scope before performing any live promotion.
Step 2. Make a committed change and capture it using two approaches
cat > "$snap_lab/check.py" <<'PY'
from pathlib import Path
import shutil
import sqlite3
import sys
root = Path(sys.argv[1])
main = root / "source" / "warehouse.db"
incomplete = root / "captured" / "main-file-only.db"
backup = root / "captured" / "verified.db"
restored = root / "restored" / "warehouse.db"
def read(path, immutable_copy=False):
uri = path.resolve().as_uri() + "?mode=ro"
if immutable_copy:
uri += "&immutable=1"
conn = sqlite3.connect(uri, uri=True)
try:
integrity = conn.execute("PRAGMA integrity_check").fetchone()[0]
stock = conn.execute("SELECT cartons FROM inventory WHERE sku = ?", ("A-17",)).fetchone()[0]
events = conn.execute("SELECT id, cartons FROM deliveries ORDER BY id").fetchall()
return integrity, stock, events
finally:
conn.close()
def accept(state, cartons, events):
assert state == ("ok", cartons, events), state
source = sqlite3.connect(main)
try:
assert source.execute("PRAGMA journal_mode=WAL").fetchone()[0] == "wal"
source.execute("PRAGMA wal_autocheckpoint=0")
with source:
source.execute("CREATE TABLE inventory (sku TEXT PRIMARY KEY, cartons INTEGER NOT NULL)")
source.execute("CREATE TABLE deliveries (id INTEGER PRIMARY KEY, cartons INTEGER NOT NULL)")
source.execute("INSERT INTO inventory VALUES (?, ?)", ("A-17", 7))
assert source.execute("PRAGMA wal_checkpoint(TRUNCATE)").fetchone()[0] == 0
with source:
source.execute("UPDATE inventory SET cartons = ? WHERE sku = ?", (8, "A-17"))
source.execute("INSERT INTO deliveries VALUES (?, ?)", (400, 1))
assert Path(str(main) + "-wal").stat().st_size > 0
accept(read(main), 8, [(400, 1)])
# Deliberately incomplete for the experiment: copy the main file only.
shutil.copyfile(main, incomplete)
accept(read(incomplete, immutable_copy=True), 7, [])
print("Readable file-only copy: integrity ok, stock 7, missing delivery 400.")
destination = sqlite3.connect(backup)
try:
source.backup(destination)
finally:
destination.close()
accept(read(backup, immutable_copy=True), 8, [(400, 1)])
print("SQLite backup: integrity ok, stock 8 and delivery 400.")
with source:
source.execute("UPDATE inventory SET cartons = ? WHERE sku = ?", (9, "A-17"))
source.execute("INSERT INTO deliveries VALUES (?, ?)", (401, 1))
accept(read(main), 9, [(400, 1), (401, 1)])
shutil.copyfile(backup, restored)
accept(read(restored, immutable_copy=True), 8, [(400, 1)])
print("Restore retained stock 8 and delivery 400; later source work remains separate.")
finally:
source.close()
PY
python3 "$snap_lab/check.py" "$snap_lab"
The source receives one transaction, with a count of eight and ledger entry 400. The file-only copy remains able to report seven and no ledger entry. Both findings are intentional. The raw copy includes a structurally valid older version of the main database because the newer accepted write was in the sidecar log. “Integrity ok” says something about the database structure for that copy, and does not prove the content matches your business expectations. Check for the expected eight and the expected delivery together before accepting the recovery point.
The checker opens only its fixed copies with SQLite’s immutable read setting to avoid creating or accessing local write-ahead log state for those copies. It opens the active source through a regular read-only SQLite connection so it can see the source’s actual transactions. The online backup captures the important first transaction. After it finishes, the source completes transaction 401 and has nine cartons. Restoring the backup gives eight and transaction 400, the correct older state. That is the intended result for the selected recovery point. A plan that requires transaction 401 as well needs another reliable source for that later write. The result explains why choosing to replace the whole active data path is different from retrieving selected earlier records. Keep the current state available until the owner has decided how to reconcile legitimate later work.
Step 3. Verify the paths and remove the private fixture
test -s "$snap_lab/restored/index.html"
test -s "$snap_lab/restored/warehouse.db"
snap_cleanup
trap - EXIT
test ! -e "$snap_lab"
printf 'Local snapshot rehearsal files removed.\n'
The scratch directory includes the fabricated source and both restored files. Every database connection closes before teardown. In a real exercise, retain the approved recovery point and collect the exact IDs for ephemeral restored volumes and test instances. The local cleanup is a check that your program didn't require system services, credentials or an AWS environment. The three terminal results are separate evidence for exact file restoration, application-state checking and safe cleanup.
Compare expected and observed data before promoting a restore
Prepare an acceptance record before attaching a restored copy. Name the source volume, capture timestamp, required filesystem and a test value for each recovered item. If a captured version is uncertain, record two candidate timestamps and the visible evidence that distinguishes them. For the lab, expected stock eight and entry 400 identify the selected point. Stock nine and entry 401 identify work that happened afterward. A restored file's timestamp can complement that evidence, but the timestamp on a copied file can reflect copying rules or application behavior. A meaningful record test provides a separate signal.
At restore time, start with a harmless lookup of the exact expected item in the staging environment. Observe the volume behind the mount or the process endpoint supplying the result. Read a related record, such as the matching delivery, and use their relationship to distinguish an older but valid file from the intended recovery. Then compare which pieces of state would change if you promoted the result. Restoring the old label may be enough. Changing the currently active database would affect all writes accepted since the chosen point, including valid work that the incident had nothing to do with.
When copying a file from a restored disk, capture the expected version and consider any associated assets or settings required to serve it. For example, a recovered HTML template might reference a script name created by an earlier bundle, so copying that page alone could cause a blank browser screen. In a controlled test, request the recovered page and its important dependencies. Record which other services and data should remain intact. That makes a file-level recovery smaller than a disk replacement while still covering what the user actually observes.
If a recovery requires choosing which database records to reconcile, have the owner state which accepted transactions must remain. Compare the old and current data sets while write protection and audit requirements are in place. A logically correct merge may need a database constraint, separate audit trail or manual review. The local exercise is intentionally limited to observing the two states and choosing the captured copy. It doesn't automate business reconciliation. A verified old version gives you a reliable input to that later decision.
Work through a recovery decision with exact timestamps and items
Suppose the service reads product label files from the root filesystem and approved inventory records from a separate data device. At 04:00 the team captures a restore point. At 09:10 the morning delivery adds one carton and creates entry 400. At 11:35 a second legitimate delivery creates entry 401. At 12:00 a faulty app deployment loses a product label and makes a read path display stale counts. The operator needs to re-serve the right page without discarding legitimate deliveries. That might mean recovering an old file while keeping the correct live database. First verify which error is in file serving and which reflects actual stored data.
Compare three cases. If only the file was lost, an isolated volume from the older snapshot can give you the captured label bytes. The current data device does not need to be changed. If the application changed its database connection, the original records may still be healthy and the right repair is restoring the connection configuration. If the stored records themselves were damaged, you may need a known earlier set of records and a plan for later authorized transactions. Recovering the old root and re-opening the current data path is another valid choice when code and schema remain compatible. Treat the symptoms and evidence separately before picking a resource-level action.
| Evidence | Scope of useful recovery | Proof of completion |
|---|---|---|
| File missing, data records intact | Inspect a separate restored volume and stage the one approved file | Expected content and permissions, current valid records still available |
| Correct app build, wrong configured data location | Fix the approved deployment connection or mount path | Expected device or endpoint and exact item query with current records |
| Some legitimate stored records lost | Restore and inspect selected data at a suitable point, then reconcile records | Known identities, values and newer valid transactions checked |
| Root volume fails to boot | Use a supported root-volume or replacement-instance recovery plan | Expected boot, right mounted data, healthy public or private application path |
Recovery time measurement starts with a clearly named event. Suppose an operator requests a new volume and it becomes available in four minutes. It takes another two minutes to identify and mount it. Validation then reveals the chosen snapshot predates a required record. If the recovery objective was to expose that record within six minutes, the resource timings alone do not establish that result. Record the full interval and the actual data provided by the restored endpoint. A proven use of retained logs or another point can be part of the plan. The elapsed time to create the disk is only one step.
Also record whether you selected the appropriate backup class. An archived EBS snapshot must be restored to the standard tier under the documented archive process before ordinary snapshot use. The archive copy stores the full captured blocks rather than a standard-tier incremental representation. This can be suitable for long-term rarely accessed data. It affects recovery steps and cost assumptions. A policy that meets retention needs can still miss an urgent recovery time objective if the planned point takes longer to access and test. Verify the current lifecycle restrictions for the selected storage tier.
Do not draw a general database preservation claim from copying one file. In the local exercise the expected database point is deliberately recorded after delivery 400. The captured HTML was prepared separately as a separate recovery example. It need not represent a database-consistent multi-volume capture with that SQLite data. Operationally, that distinction is useful. Sometimes you need to recover independently versioned files and database state. Other times the application requires a coordinated cut that explicitly relates those artifacts. Make the requirement visible in the manifest.
Create a verification record your backup automation can support
A backup policy should name the business resources it protects. Use source volume IDs and the relationship to each service or dataset, plus any required encryption. For a backup outside the original Region, record the destination Region and snapshot IDs, the recovery role, key access and an intended restore environment. It should be possible to determine which set is usable from actual recorded points. The timestamp of a policy creation or its friendly name does not establish that a matching snapshot exists for every required source.
Suppose a team adds a data disk but forgets to tag it. A per-volume tag policy can continue creating and expiring snapshots for earlier devices whenever expected. Its job display might look green while that new disk has no recovery history under the policy. Check the inventory against the list of required volumes and compare the age and state of their latest acceptable points. Do this on deployment changes as well as on a schedule. Use service-supported event or monitoring tools to catch explicit backup failures, and test whether your restore procedure can access the required points and resources.
For example, a plan can identify the application source, its data device, last acceptable capture, known test record, owner and expiry condition. Add the guest identification method and data recovery commands to the internal runbook, so a future operator won't infer them from filenames. If a daily backup depends on a quiesced application, include who performs or automates the pause, which acknowledgment proves it reached the expected state and when writes may resume. If the workload has changed, repeat the validation before treating the old schedule as sufficient. Recovery is evidence collected over time, not something the presence of an item list demonstrates once.
Your test design should include one negative case. An incorrectly tagged volume, wrong snapshot time, unrelated device, missing KMS access, or outdated record can invalidate the expected restoration. Choose a harmless controlled failure in a disposable environment and describe how the operator recognizes it. In the local example a raw file can pass structural validation while missing entry 400. The targeted business assertion detects that problem. A real rehearsal also needs customer-style acceptance, a rollback if you promote a recovered copy, and actual timing. Keep those checks tied to the declared service requirements.
At the end of a cloud rehearsal, compare what you retained with what you replaced. If you removed a test volume or instance, verify the exact resource deletion. If you keep a recovered copy to support an investigation, document its owner, access policy and retirement date. Snapshot archives, additional copies and temporary restored volumes can each affect costs. Keep backups only under a defined policy and verify the right data remains restorable after cleanups. A failed recovery due to removing the wrong point is much more consequential than a harmless difference in a displayed billing estimate.
Explain the recovery evidence and practise choosing the right scope
Interview questions
Why can a restored file be readable while the application is still wrong?
Readability verifies that the file or filesystem can be opened. The application may expect another recovery time, additional files or a related ledger update. Compare exact stored records and identifiers, and run an application-level check. The lab's file-only copy opens but lacks the committed delivery the business expects.
Does deleting an old incremental EBS snapshot break every later restore?
EBS preserves data other retained snapshots still reference. Select a retained point and restore that volume. Removing an old snapshot can eliminate that particular recovery point and might free only exclusively referenced data. Check image, retention and service-managed dependencies before deleting it.
What would you check before mounting a restored EBS volume on Linux?
Match its volume and attachment to the correct recovery instance in the same AZ, identify the actual guest device and partition, and check its filesystem and supported recovery options. A Nitro NVMe name can differ from the console mapping. Use a separate working copy where any repair requires writes. Verify the application sees the recovered path and data.
When should you consider a multi-volume capture?
When a workload depends on several EBS volumes from the same instance, use a deliberate included set so they can provide a coordinated crash-consistent point. Account for application requirements and external data separately. Identify all member IDs and test restoration of a valid set, not just one completed snapshot.
Should you use a root-volume replacement task to recover one old HTML file?
A separate restored volume and verified file copy is usually a smaller scope. A supported root-volume task is for root replacement, uses an eligible source and reboots the instance during the process. Choose an operation whose effect matches the lost data and the approved downtime.
Quick quiz
The current source has nine cartons and entry 401. The restored point contains eight cartons and entry 400. Which result matches this backup's capture time?
Eight and entry 400. The selected point was taken before the later source write. If the repair has to preserve 401, recover or reconcile that later work separately.
The intended recovery instance is in a different AZ from a newly created volume. Can you attach it directly?
Restore a compatible volume in the intended instance's AZ. EBS volumes are AZ-scoped. A suitable Regional snapshot can provide the input to a new volume in the selected recovery AZ.
Does a completed automated snapshot prove the backup protects every active application data path?
Compare source inventory and restore evidence. The captured scope and application data still need to match the workload's requirements. Test the intended volumes and a real record in a controlled recovery.
Practice tasks
- Sketch how the file-only backup can remain structurally valid while missing a committed transaction. Trace which bytes and what timing the SQLite online backup checks in the exercise.
- Write a recovery plan for a label accidentally removed today, starting from two saved points. Identify the lowest-impact restoration path and how you would check that current records remain intact.
- Draft an EBS retention record for one root volume and two data volumes. Include each target, its encryption and restore scope, the intended timing, and expected measurements for a valid application restore.
Recovery point matters
Choose the captured time and required files or records. Preserve legitimate work that occurred afterward.
Incremental storage
A retained snapshot can restore its own point. Shared referenced blocks remain while another snapshot needs them.
Prove the guest path
Identify the attached volume, filesystem and mount, then check the actual file and record.
Check automatic protection
Verify expected sources and completed points, then demonstrate an actual recovery at the intended destination.
Official references
- EBS snapshot storage and recovery properties
- EBS creation, consistency and encryption guidance
- Coordinated multi-volume snapshots
- Volume creation scope and initialization
- Map guest NVMe devices to EBS volume IDs
- EC2 root volume replacement rules
- EBS snapshot copy options
- Snapshot deletion and retained blocks
- Amazon Data Lifecycle Manager
- EBS archive behavior and retrieval
- Linux kernel ext4 mount behavior
- XFS mount options reference
- SQLite WAL and checkpoint behavior
- SQLite online backup API
- SQLite read-only and immutable URI options