I use the following command db_main_info=$(aws ssm get-parameter --name "env_prod_db_main" | jq -r '.Parameter .Value')
to retrieve some credential information for my db. The output looks like the following.
{ "host": "env-prod-blah-db.blah.us-east-1.rds.amazonaws.com", "dbname": "blah", "user": "root", "password": "blah" }
Then i use the following commands to store the host
,dbname
,user
, and password
.
db_main_host=$(echo $db_main_info | jq -r '.host')
db_main_name=$(echo $db_main_info | jq -r '.dbname')
db_main_user=$(echo $db_main_info | jq -r '.user')
db_main_password=$(echo $db_main_info | jq -r '.password')
I am not very familiar with bash
or jq
and i am wondering if there is a better way to store the host,dbname,user,and password.