Thanks to Steven Jack for helping me understand this
The individual parts of AWS KMS are:
Note: the “encryptor” is a key used to encrypt our private key
Here is a simple example to demonstrate the workflow:
GenerateDataKey
B
(in both unencrypted and encrypted form) being providedA
using the unencrypted B
keyA
and B
keys (as we now have encrypted versions)A
and B
) into our application (as they’re encrypted)A
, it needs to decrypt itB
keyB
key to decrypt our A
encrypted keyFurther comments from Steven Jack:
Imagine we have a Jenkins CI job that runs every week.
It has IAM perms to call GenerateDataKey
for a specific master key.
Each week it generates a new random hash for the DB password,
get’s the temp encryption key,
encrypts it and pushes both the parts needed into a Kubernetes secrets store.
Once that’s done we simply re-deploy the containers, done.
The app has decrypt perms for that master key and on boot
give the param it has from the secrets store and get back
the unencrypted key and decrypt its secret, then uses it.