Alex
Alex

Reputation: 2805

AWS CLI: RDS snapshots filtered by type

Trying to return a list of all RDS snapshots whose type is manual. I thought it'd be one of the following, but neither is working.

Column header is Type, tried this;

aws rds describe-db-snapshots --query 'Snapshots[*].{Snapshot:Snapshot}' --filters Name=Type,Values=manual --output text

AWS documentation says the name may actually be SnapshotType;

aws rds describe-db-snapshots --query 'Snapshots[*].{Snapshot:Snapshot}' --filters Name=SnapshotType,Values=manual --output text

Both are returning a variation of

An error occurred (InvalidParameterValue) when calling the DescribeDBSnapshots operation: Unrecognized filter name: SnapshotType

What am I doing wrong?

Upvotes: 1

Views: 2418

Answers (1)

Anthony Neace
Anthony Neace

Reputation: 26023

There are a couple of issues. First, per the documentation, filters is not a supported parameter of this command:

--filters (list)

This parameter is not currently supported.

Second, that query syntax is invalid for the response, because the list is named "DBSnapshots", not "Snapshots". The example query below will filter the list to only return snapshots where SnapshotType is "manual".

aws rds describe-db-snapshots --query "DBSnapshots[? SnapshotType=='manual']"

Further Reading

Upvotes: 1

Related Questions