How to find EC2 instances running a certain AMI in order to delete both AMI and EC2 instances?
<p>I have launched several EC2 instances with my custom AMI. Now I want to completely delete the AMI so firstly I need to terminate all instances running that AMI.
Is it possible to do with AWS's API?</p>

<p>For down-voters: Recommended cleanup process from AWS instructed me to terminate all instances running the AMI <a href="http://aws.amazon.com/articles/637" rel="nofollow">http://aws.amazon.com/articles/637</a>. The reference can be obsolete but no need to down vote the question.</p>