Best Practices for Database Encryption at Rest: Secure Your Data

Encryption at rest doesn't follow your data everywhere—restores and replicas can leave plaintext copies on unwatched VMs. Learn where the encryption boundary really sits, who holds the keys, and the leak points vendors don't mention.

Best Practices for Database Encryption at Rest: Secure Your Data

Your database is encrypted. The storage volume has AES-256 turned on, the compliance checkbox is ticked, and everyone sleeps a little better. Then someone restores a backup to a staging box, the encryption-at-rest layer doesn't follow, and a copy of your customer table sits in plaintext on a VM nobody watches.

I've seen this exact failure twice. Not because the encryption was wrong, but because the people who enabled it assumed "encrypted at rest" meant "encrypted everywhere the data goes." It doesn't. Best practices for database encryption at rest are less about picking an algorithm (that part is settled) and more about understanding where the encryption boundary actually sits, who holds the keys, and what happens the moment data leaves the volume it was encrypted on.

Let's separate what genuinely matters from what vendors put on the brochure.

Key takeaways

  • AES-256 in a sound mode (GCM or XTS) is the default answer for encrypting stored data. RSA is not a competitor here — it's for wrapping keys, not encrypting tables.
  • Encryption at rest protects the physical medium, not the running database. Once the server is up and the key is loaded, a query with valid credentials sees plaintext.
  • Envelope encryption plus a managed KMS or HSM is how you get key rotation and separation without re-encrypting terabytes by hand.
  • Backups and replicas are the leak point. If your restore target doesn't inherit the same key policy, you have an unencrypted copy.
  • Field-level encryption is a different tool, not a replacement — use it for a handful of highly sensitive columns, not the whole schema.

What database encryption at rest actually protects (and what it doesn't)

Picture a stolen disk. Someone walks out of a data center with a decommissioned drive, or a cloud provider's snapshot ends up in the wrong bucket. Encryption at rest turns that drive into noise. That's the threat model: physical or storage-level access without the key.

What it does not do is defend against an attacker who reaches your database through the network with valid credentials. At that point the storage engine decrypts pages on read, hands them to the query executor, and returns rows. The encryption layer never knows anything went wrong.

The three states of data, and why the boundary matters

You'll hear data described as at rest, in transit, and in use. The distinctions are useful because each state needs a different control:

  • At rest — data sitting on disk, in a snapshot, or on a backup tape. Protected by storage-level or tablespace-level encryption.
  • In transit — data moving between client and server. Protected by TLS. Separate problem entirely, and no amount of at-rest encryption compensates for a plaintext connection.
  • In use — data being processed in memory. This is the hardest one, and the honest answer is that most teams do not protect it. Confidential computing and hardware enclaves exist, but they are a project, not a checkbox.

The catch? Most breached databases I've read about weren't stolen disks. They were exposed endpoints, leaked credentials, or a misconfigured replica. Encryption at rest did nothing for any of those. It's a control against one specific class of loss, and treating it as a general security strategy is where teams go wrong.

Is AES-256 the right choice for data at rest?

Yes, and the reason is not arbitrary. AES is a symmetric block cipher: the same key encrypts and decrypts. RSA is asymmetric: a public key encrypts, a private key decrypts, and the math is orders of magnitude more expensive per byte.

If you tried to encrypt a table with RSA, you'd hit two walls immediately — the operation is slow enough to wreck throughput, and RSA can only encrypt data smaller than its key size. A 2048-bit RSA key tops out at a couple hundred bytes of payload. Fine for a password or a session key, useless for a row.

Is AES-256 for data at rest?

AES-256 is the standard choice, and it's what you'll find behind nearly every managed database encryption feature — SQL Server's Transparent Data Encryption, Azure storage service encryption, PostgreSQL with an encrypted filesystem or a TDE extension. The mode matters as much as the key length: GCM gives you authenticated encryption (tamper detection built in), while XTS is common for full-disk and tablespace encryption where block-aligned operation is the priority.

AES-128 is not broken, for what it's worth. The extra rounds in AES-256 buy margin against future cryptanalysis rather than fixing a known weakness. The real reason to pick 256 is that it's the default everywhere and arguing for 128 saves you nothing but a conversation.

Is RSA or AES better?

Wrong comparison. They do different jobs in the same system. AES encrypts the data; RSA (or more often these days, ECDH or AES key wrapping) protects the key that encrypts the data. In practice you rarely use raw RSA at all — a KMS will use a symmetric wrapping key or an elliptic-curve scheme.

QuestionAESRSA
Encrypts bulk dataYesNo (size-limited)
Key typeSymmetricAsymmetric
Speed per byteFast, hardware-acceleratedSlow
Typical role in a databaseData encryptionKey wrapping / exchange
Rotation costRe-encrypt data or rewrap keyRegenerate keypair

Key management is where encryption at rest succeeds or fails

Here's a scene I remember clearly. A team enabled TDE on a SQL Server instance, felt good about it, and then discovered that the certificate protecting the database encryption key lived only inside that instance. When the box needed rebuilding, nobody had the certificate. The restore was not a restore — it was a wipe.

Key management is where encryption at rest succeeds or fails

Encryption without key management is theater. The algorithm protects nothing if the key sits in the same place as the ciphertext, in the same access boundary, with the same admin group controlling both.

Envelope encryption, explained plainly

The pattern that scales is two-tier. A data encryption key (DEK) encrypts the actual database pages or tablespaces. A key encryption key (KEK) encrypts the DEK, and the KEK lives in a KMS or HSM. To rotate, you rewrap the DEK under a new KEK — no multi-terabyte re-encryption, just a small cryptographic operation.

  1. Generate a DEK and store it encrypted under the KEK.
  2. At startup, the database fetches the wrapped DEK and asks the KMS to unwrap it.
  3. The unwrapped DEK lives in memory only, for the life of the process.
  4. On rotation, rewrap the DEK. The data on disk never changes.

Separate the key store from the data store, and separate the people who administer each. That's the whole principle. Everything else is implementation detail.

Rotation and revocation

Rotate on a schedule and rotate on suspicion. A schedule alone is not enough — if a key is exposed, you need a documented path to rewrap or re-encrypt within hours, not at the next quarterly cycle. And write down the revocation procedure before you need it. I've watched an incident call stall for forty minutes because nobody knew who could rotate the KMS key in production.

The failures that happen around the database, not in it

Most encryption-at-rest incidents I've encountered weren't cryptographic. They were boundary problems.

Backups and replicas inherit nothing by default

A snapshot restored to a staging environment typically gets the default storage encryption of wherever it lands — which may be a different account, a different key policy, or in the worst case, no encryption at all. Audit every restore target: read replicas, analytics copies, dev sandboxes, and the dump file someone emailed to a colleague. The compliance checkbox on production does not extend to any of them.

Field-level encryption, done badly

Encrypting selected columns in the application is a legitimate technique for a small set of sensitive fields — a national ID number, a payment token, a medical note. It's usually the wrong tool for the whole schema, because it breaks indexing, sorting, and range queries. Encrypted columns don't compare usefully unless you build a separate blind index, and now you have two systems to keep in sync.

In my opinion, the split is simple: storage-level encryption for everything, application-level encryption for the handful of columns whose exposure would be catastrophic even to someone with database credentials. Don't blur it.

What about "is this data encrypted at rest?" vendor answers

Many SaaS platforms encrypt storage by default and will say so. Field-level encryption of individual records behind a separate key is a distinct feature, often sold as an add-on. If your contract or compliance requirement depends on the second thing, confirm it in writing — "we encrypt at rest" usually refers to the storage layer.

What are the best practices for database security?

Encryption at rest sits inside a broader set, and it's only as strong as the weakest adjacent control. The practices that actually reduce risk:

  • Encrypt at rest, in transit, and know where the boundary is. TLS for every connection, including internal ones.
  • Least privilege on database accounts. No shared admin logins. Separate roles for application, migration, and read-only analytics.
  • Keys in a KMS or HSM, never in application config or a repository.
  • Audit logging enabled and shipped off the database host, so an attacker with the box can't erase their tracks.
  • Patch the engine. Encryption doesn't fix a vulnerable version.
  • Test restores. An untested backup is a hope, not a control.
  • Inventory every copy — replicas, dumps, snapshots, warehouse loads.

The uncomfortable truth is that most real breaches walk in through the front door with valid credentials. Encryption at rest is the lock on the storage unit. It matters, but it doesn't guard the door you're actually leaving open.

Where to start on Monday

Turn on storage-level encryption first if it isn't already, then immediately go find the restores that escaped it. That second step catches more real risk than any algorithm discussion, and it takes an afternoon of asking uncomfortable questions about who has a copy of your data and what protects it.

The key management work is slower and less glamorous. Do it anyway. An encrypted database whose key died with the server is not a security posture — it's a very expensive paperweight, and I've seen exactly that happen to a team that thought they were done.

Wendy Vaughan

Wendy Vaughan

Wendy Vaughan is a cloud architect and DevOps strategist with deep expertise in distributed systems. She helps engineering teams design resilient, scalable platforms and streamline their delivery pipelines. Her practical approach blends technical rigor with a clear focus on real-world outcomes.

See all articles →

Related articles