Amazon Elastic MapReduce
Developer Guide (API Version 2009-03-31)
Did this page help you?  Yes | No |  Tell us about it...
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.

Terminate a Cluster

This section describes the methods of terminating a cluster. You can terminate clusters in the STARTING, RUNNING, or WAITING states. A cluster in the WAITING state must be terminated or it runs indefinitely, generating charges to your account. You can terminate a cluster that fails to leave the STARTING state or is unable to complete a step.

If you are terminating a cluster that has termination protection set on it, you must first disable termination protection before you can terminate the cluster. After termination protection is disabled, you can terminate the cluster. Clusters can be terminated using the console, the AWS CLI, the Amazon EMR CLI, or programmatically using the TerminateJobFlows API.

Depending on the configuration of the cluster, it may take up to 5-20 minutes for the cluster to completely terminate and release allocated resources, such as EC2 instances.

Terminate a Cluster Using the Console

You can terminate one or more clusters using the Amazon EMR console. The steps to terminate a cluster in the console vary depending on whether termination protection is on or off. To terminate a protected cluster, you must first disable termination protection.

To terminate a cluster with termination protection off

  1. Sign in to the AWS Management Console and open the Amazon EMR console at https://console.aws.amazon.com/elasticmapreduce/.

  2. Select the cluster to terminate. Note that you can select multiple clusters and terminate them at the same time.

  3. Click Terminate.

    Terminate option in console
  4. When prompted, click Terminate.

    Amazon EMR terminates the instances in the cluster and stops saving log data.

To terminate a cluster with termination protection on

  1. Sign in to the AWS Management Console and open the Amazon EMR console at https://console.aws.amazon.com/elasticmapreduce/.

  2. On the Cluster List page, select the cluster to terminate. Note that you can select multiple clusters and terminate them at the same time.

  3. Click Terminate.

    Terminate option in console
  4. When prompted, click Change to turn termination protection off. Note, if you selected multiple clusters, click Turn off all to disable termination protection for all the clusters at once.

  5. In the Terminate clusters dialog, for Termination Protection, click Off and then click the check mark to confirm.

    Turn termination protection off
  6. Click Terminate.

    Amazon EMR terminates the instances in the cluster and stops saving log data.

Terminate a Cluster Using the AWS CLI or the Amazon EMR CLI

To terminate an unprotected cluster using the AWS CLI

To terminate an unprotected cluster using the AWS CLI, use the terminate-clusters subcommand with the --cluster-ids parameter.

  • Type the following command to terminate a single cluster and replace j-3KVXXXXXXX7UG with your cluster ID.

    aws emr terminate-clusters --cluster-ids j-3KVXXXXXXX7UG

    To terminate multiple clusters, type the following command and replace j-3KVXXXXXXX7UG and j-WJ2XXXXXX8EU with your cluster IDs.

    aws emr terminate-clusters --cluster-ids j-3KVXXXXXXX7UG j-WJ2XXXXXX8EU

    For more information on using Amazon EMR commands in the AWS CLI, see http://docs.aws.amazon.com/cli/latest/reference/emr.

To terminate a protected cluster using the AWS CLI

To terminate a protected cluster using the AWS CLI, first disable termination protection using the modify-cluster-attributes subcommand with the --no-termination-protected parameter. Then use the terminate-clusters subcommand with the --cluster-ids parameter to terminate it.

  1. Type the following command to disable termination protection and replace j-3KVTXXXXXX7UG with your cluster ID.

    aws emr modify-cluster-attributes --cluster-id j-3KVTXXXXXX7UG --no-termination-protected
  2. To terminate the cluster, type the following command and replace j-3KVXXXXXXX7UG with your cluster ID.

    aws emr terminate-clusters --cluster-ids j-3KVXXXXXXX7UG

    To terminate multiple clusters, type the following command and replace j-3KVXXXXXXX7UG and j-WJ2XXXXXX8EU with your cluster IDs.

    aws emr terminate-clusters --cluster-ids j-3KVXXXXXXX7UG j-WJ2XXXXXX8EU

    For more information on using Amazon EMR commands in the AWS CLI, see http://docs.aws.amazon.com/cli/latest/reference/emr.

To terminate an unprotected cluster using the Amazon EMR CLI

To terminate an unprotected cluster using the Amazon EMR CLI, type the --terminate parameter and specify the cluster to terminate.

Note

The Amazon EMR CLI is no longer under feature development. Customers are encouraged to use the Amazon EMR commands in the AWS CLI instead.

  • In the directory where you installed the Amazon EMR CLI, type the following from command. For more information, see the Command Line Interface Reference for Amazon EMR.

    • Linux, UNIX, and Mac OS X users:

      ./elastic-mapreduce --terminate JobFlowID
    • Windows users:

      ruby elastic-mapreduce --terminate JobFlowID

To terminate a protected cluster using the Amazon EMR CLI

Note

The Amazon EMR CLI is no longer under feature development. Customers are encouraged to use the Amazon EMR commands in the AWS CLI instead.

  1. Disable termination protection by setting the --set-termination-protection parameter to false. This is shown in the following example, where JobFlowID is the identifier of the cluster on which to disable termination protection.

    elastic-mapreduce --set-termination-protection false --jobflow JobFlowID
  2. Terminate the cluster using the --terminate parameter and the cluster identifier of the cluster to terminate.

    In the directory where you installed the Amazon EMR CLI, type the following command. For more information, see the Command Line Interface Reference for Amazon EMR.

    • Linux, UNIX, and Mac OS X users:

      ./elastic-mapreduce --terminate JobFlowID
    • Windows users:

      ruby elastic-mapreduce --terminate JobFlowID

Terminate a Cluster Using the API

The TerminateJobFlows operation ends step processing, uploads any log data from Amazon EC2 to Amazon S3 (if configured), and terminates the Hadoop cluster. A cluster also terminates automatically if you set KeepJobAliveWhenNoSteps to False in a RunJobFlows request.

You can use this action to terminate either a single cluster or a list of clusters by their cluster IDs.

For more information about the input parameters unique to TerminateJobFlows, see TerminateJobFlows. For more information about the generic parameters in the request, see Common Request Parameters.