Skip to content

Instantly share code, notes, and snippets.

@Calcifer777
Created October 25, 2020 21:05
Show Gist options
  • Select an option

  • Save Calcifer777/0590e3c12a0581a6ed7e8f263e4aee0e to your computer and use it in GitHub Desktop.

Select an option

Save Calcifer777/0590e3c12a0581a6ed7e8f263e4aee0e to your computer and use it in GitHub Desktop.
AWS KMS Encrypt - Decrypt
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