Created
February 8, 2023 14:28
-
-
Save djnorrisdev/062de4d1d71df69beed32c212404df85 to your computer and use it in GitHub Desktop.
Create jwt keys for aws
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
| Create a key pair and b64 encode them: | |
| ``` | |
| ssh-keygen -t rsa -b 4096 -m PEM -f ./jwtcookie.key | |
| rsa_priv_key=$(openssl base64 -in jwtcookie.key -A) | |
| rsa_pub_key=$(openssl base64 -in jwtcookie.key.pub -A) | |
| ``` | |
| Put the base-64 encoded keys into a json file like so: | |
| ``` | |
| cat << EOL > jwtkeys.json | |
| { | |
| "rsa_priv_key": "$rsa_priv_key", | |
| "rsa_pub_key": "$rsa_pub_key" | |
| } | |
| EOL | |
| ``` | |
| Create the secret in AWS, referencing the json file created above | |
| ``` | |
| aws $AWSENV secretsmanager create-secret --name jwt_secret_for_tea \ | |
| --description "RS256 keys for app JWT cookies" \ | |
| --secret-string file://jwtkeys.json | |
| ``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment