Skip to content

Instantly share code, notes, and snippets.

@djnorrisdev
Created February 8, 2023 14:28
Show Gist options
  • Select an option

  • Save djnorrisdev/062de4d1d71df69beed32c212404df85 to your computer and use it in GitHub Desktop.

Select an option

Save djnorrisdev/062de4d1d71df69beed32c212404df85 to your computer and use it in GitHub Desktop.
Create jwt keys for aws
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