sessions
Creates, updates, deletes, gets or lists a sessions resource.
Overview
| Name | sessions |
| Type | Resource |
| Id | aws.redshift_data.sessions |
Fields
The following fields are returned by SELECT queries:
- list_sessions
| Name | Datatype | Description |
|---|---|---|
cluster_identifier | string | The cluster identifier. This element is not returned when connecting to a serverless workgroup. |
created_at | string (date-time) | The date and time (UTC) when the session was created. |
current_statement_id | string | The 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>) |
database | string | The name of the database that the session is connected to. |
db_user | string | The database user name. |
session_alive_seconds | integer | The number of seconds that the session is kept alive after a query finishes. |
session_id | string | The 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_ttl | string (date-time) | The date and time (UTC) when the session is set to expire and be closed. |
status | string | The 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_at | string (date-time) | The date and time (UTC) that the session metadata was last updated. An example is the time the status last changed. |
workgroup_name | string | The 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:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list_sessions | select | region | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- list_sessions
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
;