Search code examples
amazon-web-servicesamazon-rdsaws-cli

How to list AWS RDS instances that are stopped


I'm trying to use the AWS CLI to list all the AWS RDS instances that I have that are in a Stopped status.

It's possible with EC2 with aws ec2 describe-instances and adding a filter --filters "Name=instance-state-name,Values=stopped".

However, with aws rds describe-db-instances, I do not find an equivalent. There is a --filter option, but only had the following options as filters: db-cluster-id, db-instance-id, dbi-resource-id, domain, engine.

So what AWS CLI command can I use to list all the RDS instances that are currently Stopped (Status=stopped)?


Solution

  • Use --query instead of --filters:

    something like:

    aws rds describe-db-instances --query '...'
    

    https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-filter.html