Skip to content

Instantly share code, notes, and snippets.

@RafalSladek
Created November 5, 2018 11:49
Show Gist options
  • Save RafalSladek/e4a16c867c4fdf0f55a8c692b0193333 to your computer and use it in GitHub Desktop.
Save RafalSladek/e4a16c867c4fdf0f55a8c692b0193333 to your computer and use it in GitHub Desktop.
How to de-/encrypt password with KMS
#!/bin/bash
## How to encrypt password with KMS?
aws kms encrypt --key-id <KMS_KEY_ID> --plaintext fileb://password.txt --output text --query CiphertextBlob
## How to decrypt password with KMS?
echo "<DECRYPTED_SECRET_HERE>" | base64 --decode > password.base64
aws kms decrypt --ciphertext-blob fileb://password.base64 --output text --query Plaintext | base64 --decode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment