Search code examples
c#.netamazon-s3amazon-web-servicesamazon-ebs

How can I delete an image (AMI) in AWS EC2 using the SDK?


I am using CreateImage() to create a new AMI from an existing Instance and I was hoping there was a DeleteImage() which would work in the converse fashion. Unfortunately this method does not exist on the EC2Client.

What is the proper way to delete an AMI through the SDK using C#?


Solution

  • There is a DeregisterImage() that should do what you want. Note that it's up to you to delete any snapshots the image may be based upon afterward.