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?
For down-voters: Recommended cleanup process from AWS instructed me to terminate all instances running the AMI http://aws.amazon.com/articles/637. The reference can be obsolete but no need to down vote the question.
You can delete the AMI without deleting any instances that were created using that AMI. Your question makes it sound like that's not possible.
You can easily browse the EC2 instances in the AWS web console and see what AMI was used to create them. Or you can use the aws ec2 describe-instances command to list all your instances. The output of that command will include the ID of the AMI used to create the instance.
No need to terminate all the instances running that AMI, as per Amazon EC2 documentation you can keep those instances running deregistering the AMI won't effect the functioning of those instances.
When you deregister an AMI, it doesn't affect any instances that you've already launched from the AMI, also it doesn't affect the snapshot that was created for the root volume of the instance during the AMI creation process. You'll continue to incur storage costs for that snapshot.After you deregister an AMI, you can't use it to launch new instances.
Cleaning Up Your Amazon EBS-Backed AMI
To clean up your Amazon EBS-backed AMI
For you to refer : http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/deregister-ami.html or EC2 documentation page no-107
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With