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.