Reputation: 129
When we run the command using filters we are getting the error:
$ aws rds describe-db-instances --filters Name=instance-state-name,Values=running
An error occurred (InvalidParameterValue) when calling the
DescribeDBInstances operation: Unrecognized filter name: instance-state-name.
What is the correct syntax for using filters for aws rds describe-db-instances
?
Upvotes: 6
Views: 17619
Reputation: 1
Adding quotes should work
example:
aws rds describe-db-cluster-endpoints --db-cluster-identifier=aurora-cluster-dev --query 'DBClusterEndpoints[*].[Endpoint]' --filters 'Name=db-cluster-endpoint-type,Values=writer'
Upvotes: 0
Reputation: 8455
Your syntax seems to be fine, but instance-state-name
is simply not a valid filter for RDS.
From the documentation:
--filters (list)
A filter that specifies one or more DB instances to describe.
Supported filters:
db-cluster-id - Accepts DB cluster identifiers and DB cluster Ama-
zon Resource Names (ARNs). The results list will only include
information about the DB instances associated with the DB Clusters
identified by these ARNs.
db-instance-id - Accepts DB instance identifiers and DB instance
Amazon Resource Names (ARNs). The results list will only include
information about the DB instances identified by these ARNs.
As something like instance-state-name
doesn't exist for RDS I assume what you're searching for instead is DBInstanceStatus
. While it's not possible to use --filter
to filter for that, you can use --query
:
aws rds describe-db-instances --query 'DBInstances[?DBInstanceStatus==`available`]'
The difference between --filter
and --query
is that --filter
directly influences what's sent back by the API, while --query
does some local filtering of the results received from the API. As long as you don't have a very large amount of RDS instances, --query
should work fine for you.
Upvotes: 10