Skip to content

Instantly share code, notes, and snippets.

@ricbra
Created August 31, 2023 09:24
Show Gist options
  • Save ricbra/788e6c7612e81b7ac49838622781b4f0 to your computer and use it in GitHub Desktop.
Save ricbra/788e6c7612e81b7ac49838622781b4f0 to your computer and use it in GitHub Desktop.
Bash script to create AWS SSM parameters from JSON file
#!/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