Reputation: 1019
I want to retrieve a list of EC2 instances which were created in last x days. Here 'created' means the first launch of an instance. Is there a way to do this using AWS CLI or AWS Golang SDK?
I tried looking into Cloudtrail. Apparently, one could filter events within a specified period of time. So if I wanted to do the same for S3 Buckets, I would look for CreateBucket
event in last x days. But unfortunately, I could not find a similar EventName for EC2 instances. The RunInstances
event is not specific to the first launch of EC2 instances.
Upvotes: 0
Views: 1909
Reputation: 319
From the raw AWS CLI this is not possible without further post-processing of the unfiltered results. Please see below for the previous question/answer.
How to get the most recently launched EC2 instance with AWS CLI? - Stack Overflow
Upvotes: 1