Skip to content

Instantly share code, notes, and snippets.

@emalloy
Created November 17, 2017 02:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emalloy/f752b5e9a6eb7062098e491e5621f9cc to your computer and use it in GitHub Desktop.
Save emalloy/f752b5e9a6eb7062098e491e5621f9cc to your computer and use it in GitHub Desktop.
kms_encrypt.sh
#!/usr/bin/env bash
if [ -z ${KMS_KEY_ID} ]; then
echo "KMS_KEY_ID unset! Exiting";
exit 1
fi
_INPUT=$1
cat $_INPUT \
| aws kms encrypt \
--key-id=${KMS_KEY_ID} \
--plaintext fileb://<(cat -) \
--output text \
--query CiphertextBlob \
| base64 --decode > output.kms.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment