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-deregisterami-2bb65342IMAGE 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.
To delete your AMI
Execute the following command:
PROMPT>ec2-delete-bundle -b<your-s3-bucket>-p sampleimage -a<aws-access-key-id>-s<aws-secret-access-key>Deleting AMI bundle parts from https://s3.amazonaws.com/<your-s3-bucket>... Deleted sampleimage.part.00. Deleted sampleimage.part.01. Deleted sampleimage.part.02. Deleted sampleimage.part.03. ... Deleted sampleimage.part.23. Deleted sampleimage.part.24. Delete Bundle complete.
![]() | 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-instancesi-10a64379INSTANCE 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 |
|---|---|
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.
|