Created
October 25, 2020 21:05
-
-
Save Calcifer777/0590e3c12a0581a6ed7e8f263e4aee0e to your computer and use it in GitHub Desktop.
AWS KMS Encrypt - Decrypt
This file contains hidden or 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
| secret=MySuperSecret | |
| keyId=someKeyId | |
| encrypt: | |
| aws kms encrypt \ | |
| --key-id $keyId \ | |
| --plaintext $(echo $secret | base64) \ | |
| | jq -r '.CiphertextBlob' | |
| decrypt: | |
| aws kms decrypt \ | |
| --key-id ${keyId} \ | |
| --ciphertext-blob fileb://<(echo "${ENCRYPTED_PASSWORD}" | base64 -d) \ | |
| --output text \ | |
| --query Plaintext | \ | |
| base64 -d | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment