Skip to content

Instantly share code, notes, and snippets.

@elblivion
Created July 29, 2016 13:44
Show Gist options
  • Save elblivion/63e93a805a1389c0b32f3dd03c70a354 to your computer and use it in GitHub Desktop.
Save elblivion/63e93a805a1389c0b32f3dd03c70a354 to your computer and use it in GitHub Desktop.
AWS KMS for Chef data bags
$ aws kms encrypt --key-id arn:aws:kms:us-east-1:<my_account>:key/<my_key> --plaintext $(cat ~/.chef/prod-secret) --query CiphertextBlob --output text | base64 -D > secret
$ aws kms decrypt --ciphertext-blob fileb://secret --output text --query Plaintext | base64 -D > decoded
$ if [[ "$(cat decoded)" == "$(cat ~/.chef/prod-secret)" ]]; then echo "got back original chef secret"; fi
got back original chef secret
@elblivion
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment