Question:
I want to write a script that prints out all the AMIs created before (or after) a certain date. However, I am really struggling to do this so any help is sincerely appreciated.
I don’t have much now, but this is what I have so far:
1 2 |
aws ec2 describe-images > c:\ami_names.txt |
Any tips on how to filter out just for the AMIs created before a certain date?
Answer:
Here’s an example that queries for all images created after April 1st, 2016:
1 2 |
aws ec2 describe-images --query 'Images[?CreationDate>=`2016-04-01`][]' |
I believe you should be able to expand on that example to get everything you need.