Cleaning Up

Topics

If you no longer need your AMI you should deregister it from Amazon EC2.

For this task you'll need your AWS Access Key ID (<aws-access-key-id>) and AWS Secret Access Key (<aws-secret-access-key>). For more information on how to find these keys, see Signing up for Amazon S3.

To deregister an AMI

  • Execute the following command:

    PROMPT>  ec2-deregister ami-2bb65342 
    IMAGE ami-2bb65342 

You may delete your deregistered AMIs from Amazon S3. If you don't then you will continue to be charged for the space you're using.

The AMI tools contain a command to delete your image. You can get these from the resource center or they are installed on the instance from which you created the image.

[Note]Note

If you are unable to run the AMI tools, you can use any Amazon S3 utility to delete AMIs.

As soon as your instance starts to boot, you will be billed for the resources it consumes. Once you have decided that you no longer require its services, you can terminate an instance using the instance identifier you received in Running an Instance.

To terminate an instance

  • Execute the following command:

    PROMPT>  ec2-terminate-instances i-10a64379 
    INSTANCE i-10a64379 running shutting-down 

    It will take a few minutes for the instance to terminate because Amazon EC2 needs to clean-up your data. For information on checking the status of you instance, see Running an Instance

[Tip]Tip

You can also terminate your instances by logging onto the instances with your ssh tool and running the "shutdown -h" command. Don't forget the "-h", otherwise you will put your instance into single user mode. You will find the latter quite useless.

# /sbin/shutdown -h now