Im writing bash script for AWS Secret Manager .
Question:
I have one aws secret manager it will contain multiple secret
Example: aws secretsmanager get-secret-value --secret-id Example | jq -r ".SecretString"
input.json
{"Username":"admin","Password":"admin","Endpoint":"localhost","DatabaseName":"example","Port":"3306"}
Using this command got a json output
Now I want to extract All values like (Username , password,..)
After get all extract values add in another json file called (secondfile.json)
I have another json file it will contain
this is secondfile.json
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"Aurora": {
"Username": "",
"Password": "",
"Endpoint": "",
"DatabaseName": "",
"Port": ""
}
}
Sample Output: extracted values now stored second file.json file in Aurora[] array elements.
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"Aurora": {
"Username": "admin",
"Password": "admin",
"Endpoint": "localhost",
"DatabaseName": "example",
"Port": "3306"
}
}
Need Help on do with bash script .
Note: Input.json value not fixed , it may be contain 3 json key/value or n number of key/value