SetTerminationProtection - Amazon EMR

SetTerminationProtection

SetTerminationProtection locks a cluster (job flow) so the Amazon EC2 instances in the cluster cannot be terminated by user intervention, an API call, or in the event of a job-flow error. The cluster still terminates upon successful completion of the job flow. Calling SetTerminationProtection on a cluster is similar to calling the Amazon EC2 DisableAPITermination API on all Amazon EC2 instances in a cluster.

SetTerminationProtection is used to prevent accidental termination of a cluster and to ensure that in the event of an error, the instances persist so that you can recover any data stored in their ephemeral instance storage.

To terminate a cluster that has been locked by setting SetTerminationProtection to true, you must first unlock the job flow by a subsequent call to SetTerminationProtection in which you set the value to false.

For more information, see Managing Cluster Termination in the Amazon EMR Management Guide.

Request Syntax

{ "JobFlowIds": [ "string" ], "TerminationProtected": boolean }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

JobFlowIds

A list of strings that uniquely identify the clusters to protect. This identifier is returned by RunJobFlow and can also be obtained from DescribeJobFlows .

Type: Array of strings

Length Constraints: Minimum length of 0. Maximum length of 10280.

Pattern: [\u0020-\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF\r\n\t]*

Required: Yes

TerminationProtected

A Boolean that indicates whether to protect the cluster and prevent the Amazon EC2 instances in the cluster from shutting down due to API calls, user intervention, or job-flow error.

Type: Boolean

Required: Yes

Response Elements

If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalServerError

Indicates that an error occurred while processing the request and that the request was not completed.

HTTP Status Code: 400

Examples

Example

This example illustrates one usage of SetTerminationProtection.

Sample Request

POST / HTTP/1.1 Content-Type: application/x-amz-json-1.1 X-Amz-Target: ElasticMapReduce.SetTerminationProtection Content-Length: 61 User-Agent: aws-sdk-ruby/1.9.2 ruby/1.9.3 i386-mingw32 Host: us-east-1.elasticmapreduce.amazonaws.com X-Amz-Date: 20130716T211420Z X-Amz-Content-Sha256: c362fadae0fce377aa63f04388aeb90c53cedb17a8bfbb8cffcb10c2378137f9 Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20130716/us-east-1/elasticmapreduce/aws4_request, SignedHeaders=content-length;content-type;host;user-agent;x-amz-content-sha256;x-amz-date;x-amz-target, Signature=764b6aa1a38733cadff35a2e884887e9f1208a422266bc83ac77e8d0b80bd4cf Accept: */* { "JobFlowIds": ["j-3TS0OIYO4NFN"], "TerminationProtected": true }

Sample Response

HTTP/1.1 200 OK x-amzn-RequestId: af23b1db-ee5c-11e2-9787-192218ecb460 Content-Type: application/x-amz-json-1.1 Content-Length: 0 Date: Tue, 16 Jul 2013 21:14:21 GMT

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: