I'm trying to query the snapshots created after a specific date and it is returning no results. The query I am trying is below:
aws ec2 describe-snapshots --query 'Snapshots[?StartTime >= `2017-06-01`].{id:SnapshotId}' --owner-ids nnnnnnnnnnn
If I remove the --query section, all snapshots are returned, so I know it's something to do with the query.
I tried checking the JMESPath docs but there isn't much there on date manipulation. I also tried replicating the syntax in the example here to no avail.
Thanks,
Your code example is working perfectly well for me! (With my Account ID.)
Find the date on a snapshot, then put that date in the query -- one day before and then run it again for one day after. That should help you track down the strange behaviour.
$ aws ec2 describe-snapshots --query 'Snapshots[?StartTime >= `2016-08-30`].{id:SnapshotId}' --owner-ids 123456789012
[
{
"id": "snap-e044d613"
},
{
"id": "snap-f4444506"
}
]
$ aws ec2 describe-snapshots --query 'Snapshots[?StartTime >= `2016-08-31`].{id:SnapshotId}' --owner-ids 123456789012
[]