Deregister your AMI
You can deregister an AMI when you have finished using it. After you deregister an AMI, you can't use it to launch new instances.
When you deregister an AMI, it doesn't affect any instances that you've already launched from the AMI or any snapshots created during the AMI creation process. You'll continue to incur usage costs for these instances and storage costs for the snapshot. Therefore, you should terminate any instances and delete any snapshots that you're finished with.
The procedure that you'll use to clean up your AMI depends on whether it's backed by Amazon EBS or instance store. For more information, see Determine the root device type of your AMI.
Contents
Considerations
The following considerations apply to deregistering AMIs:
-
You can't deregister an AMI that is not owned by your account.
-
You can't deregister an AMI that is managed by the AWS Backup service using Amazon EC2. Instead, use AWS Backup to delete the corresponding recovery points in the backup vault. For more information, see Deleting backups in the AWS Backup Developer Guide.
Clean up your Amazon EBS-backed AMI
When you deregister an Amazon EBS-backed AMI, it doesn't affect the snapshot(s) that were created for the volume(s) of the instance during the AMI creation process. You'll continue to incur storage costs for the snapshots. Therefore, if you are finished with the snapshots, you should delete them.
The following diagram illustrates the process for cleaning up your Amazon EBS-backed AMI.

You can use one of the following methods to clean up your Amazon EBS-backed AMI.
Clean up your instance store-backed AMI
When you deregister an instance store-backed AMI, it doesn't affect the files that you uploaded to Amazon S3 when you created the AMI. You'll continue to incur usage costs for these files in Amazon S3. Therefore, if you are finished with these files, you should delete them.
The following diagram illustrates the process for cleaning up your instance store-backed AMI.

To clean up your instance store-backed AMI
-
Deregister the AMI using the deregister-image command as follows.
aws ec2 deregister-image --image-id
ami_id
-
Delete the bundle in Amazon S3 using the ec2-delete-bundle (AMI tools) command as follows.
ec2-delete-bundle -b
myawsbucket/myami
-ayour_access_key_id
-syour_secret_access_key
-pimage
-
(Optional) If you are finished with an instance that you launched from the AMI, you can terminate it using the terminate-instances command as follows.
aws ec2 terminate-instances --instance-ids
instance_id
-
(Optional) If you are finished with the Amazon S3 bucket that you uploaded the bundle to, you can delete the bucket. To delete an Amazon S3 bucket, open the Amazon S3 console, select the bucket, choose Actions, and then choose Delete.
Last launched time
LastLaunchedTime
is a timestamp that indicates when your AMI was last used to
launch an instance. AMIs that have not been used recently to launch an instance might be good
candidates for deregistering or deprecation.
Note
-
When the AMI is used to launch an instance, there is a 24-hour delay before that usage is reported.
-
lastLaunchedTime
data is available starting April 2017.