- Newest
- Most votes
- Most comments
Based on the documentation, the behavior you observed in Test 1 is expected. When you deregister an EBS-backed AMI and choose to delete its associated snapshots at the same time, the AMI moves to the Recycle Bin only if it matches a retention rule. However, the snapshots are deleted as part of the deregistration process, which is why you see them separately in the Recycle Bin.
When you deregister an AMI without deleting snapshots (Test 2), the AMI itself goes to the Recycle Bin while the snapshots remain active, which is why you see the AMI but not the snapshots in Recycle Bin resources.
Regarding recovery: An AMI can only be restored from the Recycle Bin if it can be fully reconstructed. Since EBS-backed AMIs depend on their associated snapshots, if those snapshots are permanently deleted or no longer available, the AMI cannot be successfully restored to a functional state.
Your proposed safe procedure is sound:
- Create Recycle Bin retention rules for both AMIs and EBS snapshots with matching retention periods
- Deregister AMIs without deleting snapshots
- Separately delete the snapshots afterward
This approach ensures both the AMI and its snapshots are protected in the Recycle Bin and can be recovered independently within the retention period. This gives you the flexibility to restore either component if needed, and the AMI can be fully restored as long as its snapshots are still available in the Recycle Bin.
It's worth noting that deregistering an AMI does not affect instances already launched from it, and you'll continue to incur costs for both running instances and stored snapshots until you explicitly terminate or delete them.
Sources
Deregister an Amazon EC2 AMI - Amazon Elastic Compute Cloud
DeregisterImage - Amazon Elastic Compute Cloud
deregister - Boto3 1.42.50 documentation
deregister_image - Boto3 1.42.50 documentation
Hello.
If the EBS snapshot has been deleted and is not in the Recycle Bin, the AMI cannot be restored from the Recycle Bin.
I tried restoring using my AWS account, but an error occurred and I was unable to restore the AMI.
Therefore, as you understand, I believe it is safest to create the same retention rule for both AMIs and EBS snapshots.
As mentioned in the following documentation, a snapshot is required to use an AMI, so if there is no snapshot left in the Recycle Bin, I think the AMI will also become unusable.
https://docs.aws.amazon.com/ebs/latest/userguide/recycle-bin-working-with-amis.html#recycle-bin-restore-ami
You can't use an AMI in any way while it is in the Recycle Bin. To use the AMI, you must first restore it. When you restore an AMI from the Recycle Bin, the AMI is immediately available for use, and it is removed from the Recycle Bin. You can use a restored AMI in the same way that you use any other AMI in your account.
Thank you for the prompt response and review.
I have double checked and will recommend to my customer using the outlined procedure.
Unless I am missing something, I think the documentation quoted by Riku, while useful, does not apply directly to my question (in my case the snapshots were in the recycle bin, the AMI wasn´t)
I would still recommend updating the docs
Relevant content
- asked 4 years ago
- asked a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 years ago
