Deregister your Linux AMI - Amazon Elastic Compute Cloud

Deregister your Linux 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. You'll continue to incur usage costs for these instances. Therefore, if you are finished with these instances, you should terminate them.

The procedure that you'll use to clean up your AMI depends on whether it is backed by Amazon EBS or instance store. For more information, see Determine the root device type of your AMI.

Note

An AMI must be owned by your account in order to deregister it.

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.


        Process to clean up your Amazon EBS-backed AMI

You can use one of the following methods to clean up your Amazon EBS-backed AMI.

New console

To clean up your Amazon EBS-backed AMI using the console

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. Deregister the AMI

    1. In the navigation pane, choose AMIs.

    2. Select the AMI to deregister, and take note of its ID — this can help you find the snapshots to delete in the next step.

    3. Choose Actions, and then Deregister. When prompted for confirmation, choose Continue.

      Note

      It might take a few minutes before the console removes the AMI from the list. Choose Refresh to refresh the status.

  3. Delete snapshots that are no longer needed

    1. In the navigation pane, choose Snapshots.

    2. Select a snapshot to delete (look for the AMI ID from the prior step in the Description column).

    3. Choose Actions, and then choose Delete. When prompted for confirmation, choose Yes, Delete.

  4. Terminate instances (Optional)

    If you are finished with an instance that you launched from the AMI, you can terminate it.

    1. In the navigation pane, choose Instances then select the instance to terminate.

    2. Choose Actions, then Instance state, and then Terminate instance. When prompted for confirmation, choose Terminate.

Note

You may need to scroll down for some of the Actions menu items.

Old console

To clean up your Amazon EBS-backed AMI using the console

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. Deregister the AMI

    1. In the navigation pane, choose AMIs.

    2. Select the AMI to deregister, and take note of its ID — this can help you find the snapshots to delete in the next step.

    3. Choose Actions, and then Deregister. When prompted for confirmation, choose Continue.

      Note

      It may take a few minutes before the console removes the AMI from the list. Choose Refresh to refresh the status.

  3. Delete snapshots that are no longer needed

    1. In the navigation pane, choose Snapshots.

    2. Select a snapshot to delete (look for the AMI ID from the prior step in the Description column).

    3. Choose Actions, and then choose Delete. When prompted for confirmation, choose Yes, Delete.

  4. Terminate instances (Optional)

    If you are finished with an instance that you launched from the AMI, you can terminate it.

    1. In the navigation pane, choose Instances then select the instance to terminate.

    2. Choose Actions, then Instance State, and then Terminate. When prompted for confirmation, choose Yes, Terminate.

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.


          Process to clean up your instance store-backed AMI

To clean up your instance store-backed AMI

  1. Deregister the AMI using the deregister-image command as follows.

    aws ec2 deregister-image --image-id ami_id
  2. Delete the bundle in Amazon S3 using the ec2-delete-bundle (AMI tools) command as follows.

    ec2-delete-bundle -b myawsbucket/myami -a your_access_key_id -s your_secret_access_key -p image
  3. (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
  4. (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.