1.9. Terminate Instances
Terminating EC2 instances
Terminating an EC2 compute instance means that the instance is completely destroyed and the hardware resources are returned to the pool. In contrast, stopping an instance (which is possible for some machine images) merely shuts down the processes running on the instance, preserving any data and software on the instance.
You can use either of the following approaches to terminate instances on Amazon EC2:
Important
You should always terminate instances when you are finished with them, in order to minimize usage charges. Stopping an instance is not the same as terminating an instance
Terminate individual instances
The cleanest way to terminate an individual compute instance is to use the
fabric:container-delete
console command—for example:
JBossFuse:karaf@root> fabric:container-delete mqserver2
The advantage of this command is that all of the corresponding entries in the Fabric Registry are cleaned up, before the container's compute instance is terminated.
Terminate all containers
You can quickly terminate all of your compute instances on the EC2 cloud using the
jclouds:node-destroy-all
command, as follows:
JBossFuse:karaf@root> jclouds:node-destroy-all
Note
This example assumes that your entire fabric is hosted in the cloud, so that you do not need to worry about the consistency of registry entries when you delete it. This approach would not be appropriate, however, if you have a fabric that overlaps with host machines outside the cloud.