Skip to main content

sessions

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

Overview

Namesessions
TypeResource
Idaws.redshift_data.sessions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
cluster_identifierstringThe cluster identifier. This element is not returned when connecting to a serverless workgroup.
created_atstring (date-time)The date and time (UTC) when the session was created.
current_statement_idstringThe identifier of the SQL statement currently running in the session. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. This element is returned only when the session status is BUSY. (pattern: <code>[a-z0-9]{8}(-[a-z0-9]{4}){3}-[a-z0-9]{12}(:\d{0,2})?</code>)
databasestringThe name of the database that the session is connected to.
db_userstringThe database user name.
session_alive_secondsintegerThe number of seconds that the session is kept alive after a query finishes.
session_idstringThe session identifier. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. (pattern: <code>[a-z0-9]{8}(-[a-z0-9]{4}){3}-[a-z0-9]{12}(:\d{0,2})?</code>)
session_ttlstring (date-time)The date and time (UTC) when the session is set to expire and be closed.
statusstringThe status of the session. Status values are defined as follows: AVAILABLE – The session is open and ready to run a SQL statement. BUSY – The session is currently running a SQL statement. CLOSED – The session is closed and can no longer run SQL statements. (AVAILABLE, BUSY, CLOSED)
updated_atstring (date-time)The date and time (UTC) that the session metadata was last updated. An example is the time the status last changed.
workgroup_namestringThe serverless workgroup name or Amazon Resource Name (ARN). This element is not returned when connecting to a provisioned cluster. (pattern: <code>([a-z0-9-]{3,63}|arn:(aws(-[a-z]+)*):redshift-serverless:([a-z]{2}(-gov|(-iso[a-z]?))?|eusc-[a-z]+)-[a-z]+-\d{1}:\d{12}:workgroup/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})</code>)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_sessionsselectregionLists the sessions that the caller created in the last 24 hours. By default, only sessions with a status of AVAILABLE or BUSY are returned. You can filter the results by session status, compute target (cluster or serverless workgroup), or database. To retrieve the metadata for a single session, provide the SessionId parameter. Use NextToken to page through the session list. Returns only the sessions that the caller created. When identity-enhanced role sessions are used, you must provide either the ClusterIdentifier or WorkgroupName parameter to ensure that the AWS IAM Identity Center user can only access the Amazon Redshift IAM Identity Center applications they are assigned. For more information, see Trusted identity propagation overview.

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
regionstringAWS region (default: us-east-1)

SELECT examples

Lists the sessions that the caller created in the last 24 hours. By default, only sessions with a status of AVAILABLE or BUSY are returned. You can filter the results by session status, compute target (cluster or serverless workgroup), or database. To retrieve the metadata for a single session, provide the SessionId parameter. Use NextToken to page through the session list. Returns only the sessions that the caller created. When identity-enhanced role sessions are used, you must provide either the ClusterIdentifier or WorkgroupName parameter to ensure that the AWS IAM Identity Center user can only access the Amazon Redshift IAM Identity Center applications they are assigned. For more information, see Trusted identity propagation overview.

SELECT
cluster_identifier,
created_at,
current_statement_id,
database,
db_user,
session_alive_seconds,
session_id,
session_ttl,
status,
updated_at,
workgroup_name
FROM aws.redshift_data.sessions
WHERE region = '{{ region }}' -- required
;