Course contentsShow
← Security
Lesson 1931 of 3,05239. Cloud Security - Compute and ServerlessFree lesson

Instance Termination Protection and Data Persistence

Configuring termination protection, delete on termination settings, and backup strategies for critical instances.

Instance Termination Protection and Data Persistence

What you'll learn: How to prevent accidental instance deletion and ensure critical data survives instance lifecycle events.


The Problem

Cloud instances can be terminated with a single API call or console click. Without safeguards, a misconfigured script, compromised credential, or human error could destroy critical workloads and their data. Even worse, attached storage volumes might vanish along with the instance.

Termination Protection

Termination protection is a flag you enable on critical instances that prevents accidental deletion. When enabled, attempts to terminate the instance through standard APIs or the console fail with an error. Think of it as a "safety lock" on a power tool—you must deliberately disable it before performing the destructive action.

This protection is essential for production databases, authentication servers, or any instance whose loss would cause significant business impact.

Delete on Termination Settings

Every attached storage volume has a delete on termination attribute. The root volume typically defaults to "delete on termination = true," meaning when the instance goes away, so does your data. Additional data volumes often default to "false."

For critical instances, you should:

  • Set root volumes to not delete on termination
  • Verify data volumes preserve this setting
  • Document which volumes contain persistent state

Backup Strategies

Protection settings aren't substitutes for backups. Implement layered defense:

  • Automated snapshots: Schedule regular snapshots of critical volumes (you learned this in encrypted storage lessons)
  • Snapshot retention policies: Keep multiple recovery points based on RPO requirements
  • Cross-region replication: Copy snapshots to another region for disaster recovery
  • Test restoration: Regularly verify you can actually restore from backups

Key Takeaway: Enable termination protection on critical instances, configure "delete on termination = false" for important volumes, and maintain automated backup strategies—protection settings guard against accidents, but backups guard against everything else.