How to read the following "username" from secret manage with --query string

13 Views Asked by At

I have the following string:

 aws secretsmanager get-secret-value --secret-id bitbucket --query "SecretString"

{
    "ARN": "myarn"
    "Name": "mysecret",
    "VersionId": "myversionid",
    "SecretString": "{\"password\":\"heho\",\"username\":\"myusername\"}",
    "VersionStages": [
        "AWSCURRENT"
    ],
    "CreatedDate": "2024-01-16T21:27:44.642000+00:00"
}

How am I able to get only the username of the result. With the query above, I get {\"password\":\"heho\",\"username\":\"myusername\"}", but I just want myusername.

0

There are 0 best solutions below