When I try to delete an Amazon Elastic Block Store (EBS) snapshot, I receive an error similar to the following:
"snap-xxxxxxxx: The snapshot snap-xxxxxxxx is currently in use by ami-xxxxxxxx"
Note: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, make sure that you’re using the most recent AWS CLI version.
EBS-backed Amazon Machine Images (AMIs) include EBS snapshots. If you try to delete an EBS snapshot associated with an active AMI, you receive this error.
Note: Public snapshots can't be deleted. If you try to delete a public snapshot, you receive an "unknown error occurred" message.
Before you attempt to delete an EBS snapshot, make sure that the AMI isn’t currently in use. You can use AMIs with a variety of AWS services, such as Amazon Elastic Compute Cloud (Amazon EC2), AWS Auto Scaling, AWS CloudFormation, and more. If you delete an AMI that’s used by another service or application, the function of that service or application might be affected.
If you no longer need the EBS snapshot or its associated AMI, deregister the AMI. Then, delete the EBS snapshot in the Amazon EC2 console:
- Note the AMI ID in the error message.
- Open the Amazon EC2 console, and from the navigation pane, choose AMIs.
- Choose the AMI noted in the error message, and then choose Deregister from the Actions menu.
Note: If you don’t see the AMI that you’re looking for, check any other AWS Regions that you might have used.
- Delete the EBS snapshot by using the EC2 console or the AWS CLI.
Deregister your AMI
Delete an Amazon EBS snapshot