Created
August 31, 2023 09:24
-
-
Save ricbra/788e6c7612e81b7ac49838622781b4f0 to your computer and use it in GitHub Desktop.
Bash script to create AWS SSM parameters from JSON file
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 | |
# Specify the JSON file path, contents should be like: | |
# { "environment": [ { "name": "DB_PASSWORD", "value": "password" }, { "name": "DB_USERNAME", "value": "username" } ] } | |
json_file="file.json" | |
# Loop through each environment object in the JSON file | |
jq -r '.environment[] | "aws ssm put-parameter --name /prod/app-name/" + .name + " --value " + .value + " --type SecureString"' "$json_file" | while read -r cmd; do | |
echo "$cmd" | |
eval "$cmd" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment