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
?
Each DB instance has a DB instance identifier. This customer-supplied name uniquely identifies the DB instance when interacting with the Amazon RDS API and AWS CLI commands. The DB instance identifier must be unique for that customer in an AWS Region.
Amazon RDS supports three types of instance classes: general purpose, memory optimized, and burstable performance. For more information about Amazon EC2 instance types, see Instance types in the Amazon EC2 documentation.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With