⚡ ~/naveed Interview Prep
⚡ Portfolio Home 👤 About Naveed Bio & Credentials 📫 Contact Naveed Get In Touch ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All AWS & Cloud Architecture Interview Questions Scenario 70 of 179 in AWS & Cloud Architecture
Senior DevOps / SRE [L2] AWS Cost & Architecture Production Scenario [L2]
🎯 Target Role / Context: AWS Scenario #69 (L2) · Cost & Architecture

Q: How do you enable encryption for an existing unencrypted RDS instance?

You cannot toggle encryption on an existing unencrypted RDS instance; instead you snapshot it, copy the snapshot with a KMS key to produce an encrypted snapshot, restore that into a new instance and cut traffic over.

#AWS #Cost & Architecture #L2 #Cloud #Infrastructure
🎙️ Candidate Opening & Architectural Context
"You cannot toggle encryption on an <strong>existing unencrypted RDS instance</strong>; instead you snapshot it, copy the snapshot with a KMS key to produce an encrypted snapshot, restore that into a new instance and cut traffic over. Interviewers ask this because it tests whether you know encryption at rest is fixed at creation time, can plan the downtime or replication window, and remember everything a restore does not carry over: security groups, parameter groups, endpoints and monitoring. A senior answer also covers verification and the guardrails that stop unencrypted databases from being created again."
Advertisement
⚡ Recommended Practice Lab

Want to master this scenario in a live sandbox? Stephane Maarek's AWS Certified DevOps Engineer Professional Masterclass on Udemy covers this exact problem with hands-on terminal drills.

🛠️ Production Runbook & Step-by-Step Resolution

Direct Answer: You cannot toggle encryption on an <strong>existing unencrypted RDS instance</strong>; instead you snapshot it, copy the snapshot with a KMS key to produce an encrypted snapshot, restore that into a new instance and cut traffic over. Interviewers ask this because it tests whether you know encryption at rest is fixed at creation time, can plan the downtime or replication window, and remember everything a restore does not carry over: security groups, parameter groups, endpoints and monitoring. A senior answer also covers verification and the guardrails that stop unencrypted databases from being created again.

1️⃣

Why there is no in-place switch and what the options are

Storage encryption is applied when the DB instance volumes are created, so the data must be copied into encrypted storage.

  • Snapshot-copy-restore: the standard path. Simple, supported for all engines, and requires a write freeze (or a catch-up strategy) at cutover.
  • Logical migration: create a new encrypted instance and use AWS DMS or native logical replication to sync, then cut over with minimal downtime. More moving parts but shorter outage.
  • What encryption covers: data on the underlying storage, automated backups, snapshots and read replicas. It does not replace TLS in transit, which you enable separately.
  • Decide the key: the AWS managed key aws/rds works but cannot be shared cross-account; a customer managed KMS key allows key policy control, rotation and snapshot sharing.
  • Downtime expectation: state it honestly in the interview: snapshot-restore means a write outage covering the final snapshot, copy and restore time, which grows with database size, so measure it in a rehearsal.
2️⃣

Hands-on: encrypt an existing unencrypted RDS instance with snapshots

Create a snapshot, copy it with a KMS key, then restore into a new instance.

aws rds create-db-snapshot --db-instance-identifier prod-db \
  --db-snapshot-identifier prod-db-pre-enc
aws rds wait db-snapshot-available --db-snapshot-identifier prod-db-pre-enc

aws rds copy-db-snapshot --source-db-snapshot-identifier prod-db-pre-enc \
  --target-db-snapshot-identifier prod-db-enc \
  --kms-key-id arn:aws:kms:us-east-1:111122223333:key/EXAMPLE-KEY-ID
aws rds wait db-snapshot-available --db-snapshot-identifier prod-db-enc

aws rds restore-db-instance-from-db-snapshot \
  --db-instance-identifier prod-db-encrypted \
  --db-snapshot-identifier prod-db-enc \
  --db-instance-class db.r6g.large \
  --db-subnet-group-name prod-db-subnets \
  --vpc-security-group-ids sg-0abc1234 \
  --db-parameter-group-name prod-pg15 --multi-az
  • Take a fresh snapshot and wait until it is available. For Multi-AZ, the snapshot is taken from the standby without impacting the primary on most engines.
  • Copy with a KMS key: specifying --kms-key-id during copy-db-snapshot produces the encrypted copy.
  • Restore into a new identifier and set the same instance class, subnet group, security groups and parameter group explicitly; restores do not reuse your old settings automatically.
  • Copy tags and options: use --copy-tags-to-snapshot and re-apply option groups as needed.
  • Time to restore: the first read from a restored volume can be slower while blocks hydrate lazily, so warm critical tables or run representative queries before cutover.
Advertisement
3️⃣

Plan the cutover to avoid data loss

Anything written to the old instance after the snapshot will be missing from the new one.

  • Quiesce writes: put the app in maintenance mode or read-only, then take a final snapshot and repeat the copy and restore so no data is lost. This is the simplest correct path.
  • Shorter outage: set up DMS ongoing replication (or engine-native logical replication) from the old to the new encrypted instance, then switch when lag is zero.
  • Endpoint swap: either point applications at the new endpoint through a Route 53 CNAME or secret, or rename instances with modify-db-instance --new-db-instance-identifier so the old name moves to the new database. A DNS indirection is safer and reversible.
  • Keep the old instance stopped or renamed for rollback until the new one has proven itself, then delete it and its unencrypted snapshots.
  • Secrets and connection strings: if credentials live in Secrets Manager with rotation tied to the old instance, update the secret's host field and rotation configuration for the new instance.
4️⃣

Verify encryption and parity

Check the flag, key and operational settings before declaring success.

aws rds describe-db-instances --db-instance-identifier prod-db-encrypted \
  --query 'DBInstances[0].[DBInstanceIdentifier,StorageEncrypted,KmsKeyId,DBInstanceStatus]'
# ["prod-db-encrypted", true, "arn:aws:kms:...", "available"]

aws rds describe-db-instances \
  --query 'DBInstances[?StorageEncrypted==`false`].DBInstanceIdentifier'
# anything listed still needs migrating
  • Encryption flag: StorageEncrypted must be true and KmsKeyId populated.
  • Settings parity: compare parameter groups, backup retention, maintenance window, Performance Insights, enhanced monitoring, IAM auth, deletion protection and alarms with the old instance.
  • Functional test: run schema and row-count checks, then the application smoke tests against the new endpoint.
  • Replicas: create new read replicas from the encrypted instance; they inherit encryption.
  • Backups: confirm automated backups are enabled on the new instance and that a first encrypted snapshot completes successfully.
5️⃣

Failure modes and guardrails

Handle common surprises and stop recurrence.

  • KMS permissions: the restoring principal needs access to the key; a restrictive key policy causes a confusing KMSKeyNotAccessible failure.
  • Cross-region or cross-account: copying across regions needs a key in the destination region; sharing encrypted snapshots needs a customer managed key and key policy grants.
  • Detect: enable the AWS Config managed rule rds-storage-encrypted to flag unencrypted databases.
  • Prevent: add an SCP or IAM condition denying rds:CreateDBInstance when rds:StorageEncrypted is false, and set storage_encrypted = true in Terraform modules.
  • Test the runbook: rehearse in staging and time each phase so the production window is a known quantity.
  • Aurora note: Aurora clusters follow the same principle, restoring an encrypted copy of a cluster snapshot into a new cluster, and cluster members share the cluster's key.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Rehearse the snapshot, encrypted copy and restore in staging, front the database with a DNS CNAME for a reversible cutover, and add an SCP so no new unencrypted instance can be created."
⚡ 60-Second Elevator Pitch Talking Points
  • RDS encryption is set at creation, so for an existing database I snapshot it, copy the snapshot with a KMS key and restore into a new encrypted instance.
  • I verify with describe-db-instances for StorageEncrypted and KmsKeyId, then check parameter groups, security groups and application smoke tests.
  • I automate detection with the rds-storage-encrypted Config rule and prevention with an SCP and encrypted-by-default Terraform modules.
⛔ Critical Candidate Mistakes to Avoid in This Scenario

Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:

  1. Looking for a modify-db-instance flag to turn encryption on No such in-place option exists; the only path is copying data into encrypted storage.
  2. Cutting over without freezing writes or replicating Rows written after the snapshot are silently lost on the new instance.
  3. Assuming the restored instance inherits security groups and parameter groups Restores need those specified explicitly, or the new database launches with defaults.
  4. Encrypting with aws/rds when snapshots must be shared with another account The AWS managed key cannot be shared; use a customer managed KMS key.
Advertisement
Want more AWS & Cloud Architecture scenarios?
Explore our complete collection of scenario-based AWS & Cloud Architecture interview runbooks.
Browse All AWS & Cloud Architecture Questions →