Database Encryption Overview
What you'll learn: How cloud databases protect sensitive data through multiple layers of encryption—at-rest, in-transit, and field-level.
Why Database Encryption Matters
After securing storage buckets, your databases remain one of the richest targets for attackers. Unlike simple file storage, databases contain structured, queryable data—often the crown jewels of your organization: customer records, financial transactions, authentication credentials, and proprietary business information.
Three Layers of Database Protection
Encryption at Rest
This protects data stored on physical disks. When enabled, the entire database—tables, indexes, backups, and logs—is encrypted using keys managed by your cloud provider's KMS or your own HSM. Think of it as locking your filing cabinet: even if someone steals the physical drive, they can't read the contents without the encryption key.
Most cloud databases (RDS, Azure SQL, Cloud SQL) offer transparent data encryption (TDE) that encrypts pages before writing to disk and decrypts when reading into memory—completely transparent to your application.
Encryption in Transit
This ensures data moving between your application and database remains encrypted using TLS/SSL connections. You've already learned about database connection encryption in lesson 1778—this prevents network-level eavesdropping on your queries and results.
Field-Level (Column) Encryption
The most granular approach: encrypt specific sensitive columns (like Social Security numbers or credit cards) within your database using application-layer encryption. Even if an attacker gains database access, encrypted fields remain protected. The database sees only ciphertext—decryption happens only in your trusted application code with proper keys.
Choosing Your Strategy
Most organizations use at-rest and in-transit as baseline protection, adding field-level encryption for particularly sensitive data requiring extra defense-in-depth.
Key Takeaway: Database encryption operates at three levels—encrypt the entire database at-rest, secure connections in-transit with TLS, and protect ultra-sensitive fields with application-layer encryption for comprehensive defense.