This article provides a step-by-step guide for users who encounter an error while trying to delete a snapshot, stating that the snapshot is currently in use by an AMI, even when no AMI appears to be present on the account. The solution involves deregistering the AMI before deleting the snapshot.
While trying to delete a snapshot. The error message states that the snapshot is currently in use by an Amazon Machine Image (AMI), even though there appears to be no AMI present on your account. This issue typically arises when an AMI has been disabled but not deregistered.
The Importance of Deregistering AMIs
Before you can delete an Elastic Block Store (EBS) snapshot, you must first deregister the associated AMI. If an AMI is merely disabled, it will not appear on the AMIs page if the filter is set to 'Owned by me'. And, we presume that there is no AMI present on the account.
How to Deregister a Disabled AMI
To resolve this issue, you need to change the filter on the AMI page from 'Owned by me' to 'Disabled images'. Once you switch to 'Disabled images', the list of disabled images will be displayed.
You can view disabled AMIs in the EC2 console and by using the AWS CLI.
You must be the AMI owner to view disabled AMIs. Because disabled AMIs are made private, you can't view disabled AMIs if you're not the owner.
Please refer Describe disabled AMIs for more info.
From this list, find the AMI associated with the snapshot you wish to delete. Select that AMI, click on 'Actions', and then choose 'Deregister'. Please note that the deregistration process may take a few moments to complete.
Deleting the EBS Snapshot
Once you've successfully deregistered the AMI, you'll be able to delete the EBS snapshot. Remember to always deregister and not to disable any AMIs before attempting to delete associated snapshots to avoid encountering this error in the future.
Please refer Delete an Amazon EBS snapshot for more information on the same.
Related-
Amazon EC2 now supports setting AMIs to a disabled state