Reputation: 6437
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)?
Upvotes: 3
Views: 16709
Reputation: 11
Below command helps in listing detailed info on RDS.
aws rds describe-db-instances --output text --query 'DBInstances[].[DBInstanceIdentifier, DBInstanceClass, Engine, DBInstanceStatus, InstanceCreateTime, MultiAZ, EngineVersion, PubliclyAccessible, StorageType, DeletionProtection]' > RDS-Inv.csv
Upvotes: 1
Reputation: 1073
You can do something like this:
aws rds describe-db-instances --query 'DBInstances[].DBInstanceStatus[]'
output:
[
"available"
]
Upvotes: 3
Reputation: 48236
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
Upvotes: 1