I cannot work out what is happening here.
I am using Amazon Secret Manager in a ec2 user_data bash script to retrieve a secret to be used on ec2 bootup.
SECRET_VALUE=$(aws secretsmanager get-secret-value --secret-id *** --region **** --output json | jq)This returns the full response
{"ARN": "arn:aws:secretsmanager:***:****:secret:***","Name": "***","VersionId": "***","SecretString": "{\"password\":\"********************\"}","VersionStages": ["AWSCURRENT" ],"CreatedDate": "2025-**-**T**:**:**.****+**:**"}SECRET_VALUE=$(aws secretsmanager get-secret-value --secret-id *** --region **** --output json | jq -r '.SecretString')Gets me closer
{"password":"***"}Looking at previous stackoverflows I've tried the following:
SECRET_VALUE=$(aws secretsmanager get-secret-value --secret-id *** --region **** --output json | jq -r '.SecretString | .password')jq: error (at <stdin>:10): Cannot index string with string "password"
SECRET_VALUE=$(aws secretsmanager get-secret-value --secret-id *** --region **** --output json | jq -r '.SecretString.password')jq: error (at <stdin>:10): Cannot index string with string "password"
What am I doing wrong?