0
votes

I have a use case where i take EC2 volume snapshots for multiple volumes at regular intervals of time and i also have 2 custom tags defined for snapshots. Lets call tags t1 and t2 respectively. t1 contains namespace value while t2 contains volumeID.

e.g: (s==snapshotID, n==Namespace, v==volumeID, time'x'==Time when the snapshot was taken)

s1->n1->v1->time1
s2->n1->v1->time2
s3->n1->v2->time1
s4->n1->v2->time2

I now want to list the snapshots first based on t1 and then, i want to list the latest unique snapshot for all volumes.

The output should be:

s2->n1->v1->time2
s4->n1->v2->time2

I am new to AWS CLI and wanted to seek help on how best to go forward with the task in hand.

TIA

1

1 Answers

1
votes

This should hopefully do what you want: https://github.com/thisaaronm/aws-latest-tagged-snaps

I tested it on my own account and it appears to work the way you described.