StartSession - Amazon EMR
Services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the AWS European Sovereign Cloud Region, see the AWS European Sovereign Cloud User Guide.

StartSession

Creates and starts a new Spark Connect session on the specified cluster. The cluster must be in the RUNNING or WAITING state and have sessions enabled. This operation is supported in Amazon EMR Spark 8.0.0 and later.

Request Syntax

{ "ClientRequestToken": "string", "ClusterId": "string", "EngineConfigurations": [ { "Classification": "string", "Configurations": [ "Configuration" ], "Properties": { "string" : "string" } } ], "ExecutionRoleArn": "string", "MonitoringConfiguration": { "CloudWatchLoggingConfiguration": { "Enabled": boolean, "EncryptionKeyArn": "string", "LogGroup": "string", "LogStreamNamePrefix": "string", "LogTypes": { "string" : [ "string" ] } }, "ManagedLoggingConfiguration": { "Enabled": boolean, "EncryptionKeyArn": "string" }, "S3LoggingConfiguration": { "Enabled": boolean, "EncryptionKeyArn": "string", "LogTypes": { "string" : [ "string" ] }, "LogUri": "string" } }, "Name": "string", "SessionIdleTimeoutInMinutes": number, "Tags": [ { "Key": "string", "Value": "string" } ] }

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.

ClientRequestToken

A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you retry a request that completed successfully using the same client request token, the service returns the original response without performing the operation again.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 36.

Required: No

ClusterId

The ID of the cluster on which to start the session.

Type: String

Length Constraints: Maximum length of 256.

Required: Yes

EngineConfigurations

The configuration overrides for the session. Only runtime configuration overrides are supported.

Type: Array of Configuration objects

Required: No

ExecutionRoleArn

The execution role ARN for the session. Amazon EMR uses this role to access AWS resources on your behalf during session execution.

Type: String

Length Constraints: Minimum length of 20. Maximum length of 2048.

Pattern: ^arn:(aws[a-zA-Z0-9-]*):iam::(\d{12})?:(role((\u002F)|(\u002F[\u0021-\u007F]+\u002F))[\w+=,.@-]+)$

Required: No

MonitoringConfiguration

The monitoring configuration that controls where session logs are published, such as Amazon S3, CloudWatch, or managed logging.

Type: SessionMonitoringConfiguration object

Required: No

Name

An optional name for the session.

Type: String

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

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

Required: No

SessionIdleTimeoutInMinutes

The idle timeout, in minutes. If the session is idle for this duration, Amazon EMR EC2 automatically terminates it.

Type: Long

Required: No

Tags

The tags to assign to the session.

Type: Array of Tag objects

Required: No

Response Syntax

{ "AccountId": "string", "Arn": "string", "ClusterId": "string", "Id": "string", "State": "string" }

Response Elements

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

The following data is returned in JSON format by the service.

AccountId

The AWS account ID that owns the session.

Type: String

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

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

Arn

The output contains the ARN of the session.

Type: String

Length Constraints: Minimum length of 20. Maximum length of 2048.

ClusterId

The ID of the cluster that the session was started on.

Type: String

Length Constraints: Maximum length of 256.

Id

The output contains the ID of the session.

Type: String

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

State

The state of the session at the time the request returned. When a session is first created, it enters the SUBMITTED state.

Type: String

Valid Values: SUBMITTED | STARTING | STARTED | IDLE | BUSY | TERMINATING | TERMINATED | FAILED

Errors

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

InternalServerException

This exception occurs when there is an internal failure in the Amazon EMR service.

Message

The message associated with the exception.

HTTP Status Code: 500

InvalidRequestException

This exception occurs when there is something wrong with user input.

ErrorCode

The error code associated with the exception.

Message

The message associated with the exception.

HTTP Status Code: 400

See Also

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