I would like to retrieve the DB Option Group (OptionGroupName) for an RDS by using the aws rds describe-db-instances --query
and --filters
.
Just FYI I can not use jq
to filter the json response from aws rds describe-db-instances
.
I would like to retrieve the DB Option Group (OptionGroupName) for an RDS by using the aws rds describe-db-instances --query
and --filters
.
Just FYI I can not use jq
to filter the json response from aws rds describe-db-instances
.
2
Answers
I just found my answer
The Output of
describe-db-instances
looks something like:The
OptionGroupMemberships
element is a list, so it might contain multiple values. If you are only seeking the value of the first item in the list, you would use:You can combine it with other elements like this:
You can also append
--output text
to obtain the value without JSON formatting.If I ever need to experiment with the
--query
values, I go to JMESPath Tutorial — JMESPath and paste my JSON into the examples. I can then interactively attempt to write the correct query (which is how I derived the above answers).