Skip to main content

sessions

Creates, updates, deletes, gets or lists a sessions resource.

Overview

Namesessions
TypeResource
Idaws.emr_serverless.sessions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe optional name of the session. (pattern: <code>.\S.</code>)
application_idstringThe ID of the application that the session belongs to. (pattern: <code>[0-9a-z]+</code>)
arnstringThe Amazon Resource Name (ARN) of the session. (pattern: <code>arn:(aws[a-zA-Z0-9-]*):emr-serverless:.+:(\d{12}):/applications/[0-9a-zA-Z]+/sessions/[0-9a-zA-Z]+</code>)
billed_resource_utilizationobjectThe aggregate vCPU, memory, and storage that Amazon Web Services has billed for the session. The billed resources include a 1-minute minimum usage for workers, plus additional storage over 20 GB per worker. Note that billed resources do not include usage for idle pre-initialized workers.
configuration_overridesobjectThe configuration overrides for the session, including runtime configuration properties.
created_atstring (date-time)The date and time that the session was created.
created_bystringThe IAM principal that created the session. (pattern: <code>arn:(aws[a-zA-Z0-9-]*):(iam|sts)::(\d{12})?:[\w/+=,.@-]+</code>)
ended_atstring (date-time)The date and time that the session was terminated or failed.
execution_role_arnstringThe Amazon Resource Name (ARN) of the execution role for the session. (pattern: <code>arn:(aws[a-zA-Z0-9-]*):iam::([0-9]{12}):(role((\u002F)|(\u002F[\u0021-\u007F]+\u002F))[\w+=,.@-]+)</code>)
idle_sincestring (date-time)The date and time that the session became idle.
idle_timeout_minutesinteger (int64)The idle timeout in minutes for the session. After the session remains idle for this duration, it is automatically terminated.
network_configurationobjectThe network configuration for customer VPC connectivity.
release_labelstringThe Amazon EMR release label associated with the session. (pattern: <code>[A-Za-z0-9._/-]+</code>)
session_idstringThe ID of the session. (pattern: <code>[0-9a-z]+</code>)
started_atstring (date-time)The date and time that the session moved to a running state.
statestringThe state of the session. (SUBMITTED, STARTING, STARTED, IDLE, BUSY, FAILED, TERMINATING, TERMINATED)
state_detailsstringAdditional details about the current state of the session. (pattern: <code>.\S.</code>)
tagsobjectThe tags assigned to the session.
total_execution_duration_secondsinteger (int64)The total execution duration of the session in seconds.
total_resource_utilizationobjectThe aggregate vCPU, memory, and storage resources used from the time the session starts to execute, until the time the session terminates, rounded up to the nearest second.
updated_atstring (date-time)The date and time that the session was last updated.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_sessionselectapplication_id, session_id, regionDisplays detailed information about a session.
list_sessionsselectapplication_id, regionnextToken, maxResults, states, createdAtAfter, createdAtBeforeLists sessions for the specified application. You can filter sessions by state and creation time.
terminate_sessiondeleteapplication_id, session_id, regionTerminates the specified session. After you terminate a session, it enters the TERMINATING state and then the TERMINATED state. You can still access the Spark History Server for a terminated session through the GetResourceDashboard operation.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
application_idstringThe ID of the application that the session belongs to.
regionstringAWS region (default: us-east-1)
session_idstringThe ID of the session to terminate.
createdAtAfterstring (date-time)The lower bound of the option to filter by creation date and time.
createdAtBeforestring (date-time)The upper bound of the option to filter by creation date and time.
maxResultsintegerThe maximum number of sessions to return in each page of results.
nextTokenstringThe token for the next set of session results.
statesarrayAn optional filter for session states. Note that if this filter contains multiple states, the resulting list will be grouped by the state.

SELECT examples

Displays detailed information about a session.

SELECT
name,
application_id,
arn,
billed_resource_utilization,
configuration_overrides,
created_at,
created_by,
ended_at,
execution_role_arn,
idle_since,
idle_timeout_minutes,
network_configuration,
release_label,
session_id,
started_at,
state,
state_details,
tags,
total_execution_duration_seconds,
total_resource_utilization,
updated_at
FROM aws.emr_serverless.sessions
WHERE application_id = '{{ application_id }}' -- required
AND session_id = '{{ session_id }}' -- required
AND region = '{{ region }}' -- required
;

DELETE examples

Terminates the specified session. After you terminate a session, it enters the TERMINATING state and then the TERMINATED state. You can still access the Spark History Server for a terminated session through the GetResourceDashboard operation.

DELETE FROM aws.emr_serverless.sessions
WHERE application_id = '{{ application_id }}' --required
AND session_id = '{{ session_id }}' --required
AND region = '{{ region }}' --required
;