How to find the latest or latest AWS RDS snapshot?

I can call aws rds describe-db-snapshots --db-instance-identifier {my_db_instance} and sort all the automatic snapshots to find the last one created, but I was hoping someone had a better idea.

+5
source share
2 answers

I know this is old, but I needed to know the same information, and I managed to build the following, which would then give me the name of the snapshot. It doesn’t fully answer your question about resolutely searching for the last snapshot, but in this example it can give you some better directions.

aws rds describe-db-snapshots -db-instance-identifier prd -snapshot-type automatic -query "DBSnapshots [? SnapshotCreateTime> = '2017-06-05']. DBSnapshotIdentifier"

To break it with options

- db-instance-identifier (enter the name of the instance you are looking for) --snapshot-type (I automated the automatic search for backups) --query "DBSnapshots [? SnapshotCreateTime> = '2017-06-05']. DBSnapshotIdentifier" (This is what I used to refine my search, since we do daily backups, I just look for the time to take the snapshot more than today and giving .DBSnapshotIdentifier returns me only the name.

Hope this helps someone else.

+4
source

As of October 31, 2014, it looks like you can use the --t flag to list only automated backups.

http://docs.aws.amazon.com/AmazonRDS/latest/CommandLineReference/CLIReference-cmd-DescribeDBSnapshots.html

From there, you can analyze the output to determine your latest snapshots.

 rds-describe-db-snapshots --t automated DBSNAPSHOT rds:<NAME>-2016-08-09-17-12 

There is no other simpler way to do this.

+1
source

All Articles