Introduction
RDS and Aurora support storage encryption, but if someone gains database access privileges, there's a risk they could view the data in plaintext.
This article introduces how to encrypt specific columns before storing them in a database using AWS KMS and AWS Encryption SDK.
1. How Encryption Works
We'll use envelope encryption in this approach.
We generate a data key with KMS and then use that data key to encrypt data on the application side.
Generate a data key with KMS
Encrypt the target data with the data key
Store both the encrypted data and encrypted data key in the database
On read, decrypt the data key with KMS, then decrypt the data itself
The key point here is that KMS protects the data key rather than directly encrypting the data itself.
2.…