Created
October 19, 2020 10:45
-
-
Save sasasin/f7d0f311b78b92d9fc408c4a5cfa76fb to your computer and use it in GitHub Desktop.
SecretsManagerをdotenv形式に変換するやつ
This file contains 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
#!/bin/bash -e | |
# SecretsManagerから取ってきたJSONのSecretStringをバラして、dotenv形式に変換する | |
# https://docs.aws.amazon.com/cli/latest/reference/secretsmanager/get-secret-value.html | |
SECRET_ID="$1" | |
aws secretsmanager get-secret-value \ | |
--secret-id "${SECRET_ID}" \ | |
--query SecretString \ | |
| jq -r 'fromjson | keys[] as $k | "\($k)=\"\(.[$k])\""' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment