Last active
September 14, 2017 11:09
-
-
Save chrisdpa-tvx/55e4f47933600bfd77a5a4a947bc4bf4 to your computer and use it in GitHub Desktop.
Encrypt a file using KMS keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws kms create-key | |
# Encrypt the contents of the file | |
aws kms encrypt \ | |
--key-id ${key_id_from_create_key_step} \ | |
--plaintext fileb://super_secret_file \ | |
--output text \ | |
--query CiphertextBlob > super_secret_file.enc.b64 | |
# Decrypt the contents of the file | |
cat super_secret_file.enc.b64 | \ | |
base64 -D | \ | |
aws kms decrypt --ciphertext-blob fileb:///dev/stdin --output text --query Plaintext | \ | |
base64 -D > super_secret_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment