3

I am trying to find a AWS Snapshot associated with AMI.

I am cleaning up my AMI list. After deregistering 2 AMI I have checked snapshot count its not reducing any reason behind this?

How can delete snapshot associated with AMI automatically when I am deleting AMI?

vitr
  • 6,766
  • 8
  • 30
  • 50
Kaviyarasu Arasu
  • 329
  • 5
  • 13
  • i give my snapshots the same name as the AMI. in python with botocore using describe_images i can look at each AMI and index ['BlockDeviceMappings'][ * ]['Ebs']['SnapshotId'] where [ * ] refers to a list that *may* have more than one element. – Skaperen Aug 19 '16 at 07:15

1 Answers1

2

When you deregister an Amazon EBS-backed AMI, 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 this snapshot. Therefore, if you are finished with the snapshot, you should delete it.

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/deregister-ami.html

And for writing some automation script, which can auto delete snapshots when you are deleting the AMI, you can have a look on following:

https://serverfault.com/questions/611831/find-all-snapshots-created-by-ami-where-ami-is-deleted

https://www.yobyot.com/aws/deregister-an-aws-ami-and-remove-associated-s3-snapshots/2014/10/30/

http://www.n2ws.com/how-to-guides/how-to-delete-unutilized-ebs-based-amis-and-corresponding-snapshots.html

Community
  • 1
  • 1
  • How do you find the snapshot though? Ive got 14 tomcat ami's here that i dont know who created them, deregister is not an option, not sure why. Maybe there is no snapshot? I dont see any way to associate, searched for the ami# in the snapshot list too. maybe i just need to unsubscribe from some subscription, really not sure. – blamb Oct 30 '19 at 18:18