> Since the configuration file is kept in the same repository as the code, configuration options or secrets can easily be changed or added by developers themselves.<p>This is terrible advice. Code and config should be separate. Otherwise you can't deploy the same <i>code</i> to a different environment.
Using KMS is a good idea, but I'm not really sure what this package gives you - just a simple abstraction / cmdline to deal with it?<p>This would be better if it could use the aliases directly, so you could have one config across N environments and separate them by AWS keyspace.<p>Having to embed the full KMS path for each key gains you the secret management they claim (which is a good thing) but sacrifices ease of use. That said, aliases wouldn't help with missing secrets or misconfiguration across environments, and its a lot easier to audit string-for-string to match your KMS store, so either approach has its pluses and minuses.
How is this different from/better than Stack Exchange's blackbox[0] which doesn't require a third-party service (just plain-ole gpg) and is written in bash?<p>[0] <a href="https://github.com/StackExchange/blackbox" rel="nofollow">https://github.com/StackExchange/blackbox</a><p>P.S.: I think the image looks aesthetically pleasing, but why is it there? It's a scaled-down 1,600x680px image that costs me 140KB and doesn't add anything to the article; what's worse is that it's not even a nice banner image, it's just smack dab in the middle of the article.
I like this design. Infrastructure as code. Store your config data in you repo. Screw 12 factors.<p>You can do this with the inhouse AWS tools, awscli and boto3 for python
This was for use within a python lambda function so i used the secrets in a seperate file, but no loss of generality here.<p>* Create your keys in KMS via Web UI or otherwise
* encrypt your secrets before commit
aws kms encrypt --key-id alias/TokenKey --plaintext fileb://unencrypted_token --output text --query CiphertextBlob > encrypted_token<p>Decrypt the token from your python lambda function with boto3<p>kms = boto3.client('kms')
token = kms.decrypt(CiphertextBlob=base64.b64decode(token_encrypted))['Plaintext'].decode('ascii')<p>The blob from KMS contains the appropriate fields for decryption from their service.
Give the lambda role rights to decrypt with the key.
It should be made clear that this requires AWS KMS, and for automatic decryption, EC2 (so that the instances can be associated with an IAM role that has key decryption permission).