Skip to main content

sessions

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

Overview

Namesessions
TypeResource
Idaws.appstream.sessions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
authentication_typestringThe authentication method. The user is authenticated using a streaming URL (API) or SAML 2.0 federation (SAML). (API, SAML, USERPOOL, AWS_AD)
connection_statestringSpecifies whether a user is connected to the streaming session. (CONNECTED, NOT_CONNECTED)
fleet_namestringThe name of the fleet for the streaming session.
idstringThe identifier of the streaming session.
instance_drain_statusstringThe drain status of the instance hosting the streaming session. This only applies to multi-session fleets. (ACTIVE, DRAINING, NOT_APPLICABLE)
instance_idstringThe identifier for the instance hosting the session.
max_expiration_timestring (date-time)The time when the streaming session is set to expire. This time is based on the MaxUserDurationinSeconds value, which determines the maximum length of time that a streaming session can run. A streaming session might end earlier than the time specified in SessionMaxExpirationTime, when the DisconnectTimeOutInSeconds elapses or the user chooses to end his or her session. If the DisconnectTimeOutInSeconds elapses, or the user chooses to end his or her session, the streaming instance is terminated and the streaming session ends.
network_access_configurationobjectDescribes the network details of the fleet or image builder instance.
stack_namestringThe name of the stack for the streaming session.
start_timestring (date-time)The time when a streaming instance is dedicated for the user.
statestringThe current state of the streaming session. (ACTIVE, PENDING, EXPIRED)
user_idstringThe identifier of the user for whom the session was created.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_sessionsselectregionRetrieves a list that describes the streaming sessions for a specified stack and fleet. If a UserId is provided for the stack and fleet, only streaming sessions for that user are described. If an authentication type is not provided, the default is to authenticate users using a streaming URL.
drain_session_instanceexecregion, SessionIdDrains the instance hosting the specified streaming session. The instance stops accepting new sessions while existing sessions continue uninterrupted. Once all sessions end, the instance is reclaimed and replaced. This only applies to multi-session fleets.
expire_sessionexecregion, SessionIdImmediately stops the specified streaming session.

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

Retrieves a list that describes the streaming sessions for a specified stack and fleet. If a UserId is provided for the stack and fleet, only streaming sessions for that user are described. If an authentication type is not provided, the default is to authenticate users using a streaming URL.

SELECT
authentication_type,
connection_state,
fleet_name,
id,
instance_drain_status,
instance_id,
max_expiration_time,
network_access_configuration,
stack_name,
start_time,
state,
user_id
FROM aws.appstream.sessions
WHERE region = '{{ region }}' -- required
;

Lifecycle Methods

Drains the instance hosting the specified streaming session. The instance stops accepting new sessions while existing sessions continue uninterrupted. Once all sessions end, the instance is reclaimed and replaced. This only applies to multi-session fleets.

EXEC aws.appstream.sessions.drain_session_instance
@region='{{ region }}' --required
@@json=
'{
"SessionId": "{{ SessionId }}"
}'
;