A production RDS instance was created without encryption. Security wants it encrypted. How?
IntermediateScenarioData and databases
Answer
Situation read → You can't turn on encryption on an existing RDS instance. You have to create an encrypted copy and move to it, so plan it like a migration.
What I'd do →
- Simple path (needs a downtime window): snapshot, copy the snapshot with a KMS key, restore from the encrypted copy.
aws rds create-db-snapshot --db-instance-identifier prod-db --db-snapshot-identifier prod-db-plain
aws rds copy-db-snapshot --source-db-snapshot-identifier prod-db-plain \
--target-db-snapshot-identifier prod-db-enc --kms-key-id alias/rds-prod
aws rds restore-db-instance-from-db-snapshot --db-instance-identifier prod-db-v2 \
--db-snapshot-identifier prod-db-enc
- Minimal-downtime path: restore the encrypted copy, then keep it in sync with logical replication or DMS CDC from the old instance, and cut over.
- Cut over by changing the endpoint the app uses (a Route 53 CNAME in front of RDS makes this a DNS change).
- Prevent: an SCP or Config rule (
rds-storage-encrypted) and Terraform defaults withstorage_encrypted = true.
Why → Encryption is set at creation, so the only way is a new encrypted instance.
Interview tip → Use a customer-managed KMS key if you'll ever share snapshots across accounts; AWS-managed keys can't be shared.
More on Data and databases
A release needs to rename a column that the running app reads and writes. How do you do it with zero downtime?IntermediateHow do you prove your database backups actually work?IntermediateDesign backups for an RDS PostgreSQL database with RPO of 5 minutes and RTO of 1 hour, including a region failure.AdvancedYour migrations run in an init container and two pods ran them at the same time during a deploy, leaving the schema half-applied. How do you fix the approach?IntermediateUpgrade RDS PostgreSQL from 13 to 17 with minimal downtime. How?AdvancedYou need to add an index and a column to a 500-million-row table that's written to constantly. How do you avoid locking it?Advanced