如何查找最新或最新的AWS RDS快照? [英] How to find latest or most recent AWS RDS snapshot?
本文介绍了如何查找最新或最新的AWS RDS快照?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以打电话给aws rds describe-db-snapshots --db-instance-identifier {my_db_instance}
并对所有自动快照进行排序,以找到最新创建的快照,但我希望有人对此有个更好的主意.
I can call aws rds describe-db-snapshots --db-instance-identifier {my_db_instance}
and sort all automated snapshots to find the most recently created one but I was hoping someone has a better idea out there.
推荐答案
对我来说,这可行:
aws rds describe-db-snapshots \
--query="reverse(sort_by(DBSnapshots, &SnapshotCreateTime))[0]"
query参数自动对它们进行排序,并且仅返回最新的.
The query parameter sorts them automatically and returns only the most recent one.
如果只需要Arn,这可能会有所帮助:
If only the Arn is needed, this one might help:
aws rds describe-db-snapshots \
--query="reverse(sort_by(DBSnapshots, &SnapshotCreateTime))[0]|DBSnapshotArn" \
--output text
以及针对特定数据库实例的所有信息:
And all that for a specific database instance:
aws rds describe-db-snapshots \
--db-instance-identifier={instance identifier} \
--query="reverse(sort_by(DBSnapshots, &SnapshotCreateTime))[0]|DBSnapshotArn" \
--output text
这篇关于如何查找最新或最新的AWS RDS快照?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文