How do I get a list of all EBS snapshots "started" before a specific date?

I am writing a Python program to get a list of all EBS snapshots in our account (owner = self) that were "started" (mostly created) before a certain date, and then do some other things on that list.

I don't think I can use filters in the get_all_snapshots () function because it only supports equalities, not GT / LT operators. I believe AWS boto Get snapshots in time period confirms this.

So, I assumed I should get a list of all of them and then iterate over the list. However, the boto documentation is not clear to me ( http://boto.readthedocs.org/en/latest/ref/ec2.html#module-boto.ec2.snapshot ) exactly which methods / properties are available for the snapshot object.

Any guidance here?

+3


source to share


1 answer


Get the connection:

conn = boto.ec2.connect_to_region("us-east-1")

      

Get pictures:



snaps = conn.get_all_snapshots(owner="self")

      

Go to the list and look at the attribute start_time

:snaps[0].start_time

Use dir(snaps[0])

to view all available attributes and find other items you need.

+5


source







All Articles