Skip to content

create_stream_url

create_stream_url(
    identifier: Identifier,
    application_identifier: Identifier,
    protocol: Protocol,
    url_expires_after_minutes: UrlExpiresAfterMinutes,
    locations: LocationList,
    *,
    config_overrides: Optional[GameLiftStreamsClientConfig] = None,
    usage_limit: Optional[UsageLimit] = None,
    description: Optional[Description] = None,
    session_length_seconds: Optional[SessionLengthSeconds] = None,
    additional_launch_args: Optional[GameLaunchArgList] = None,
    additional_environment_variables: Optional[EnvironmentVariables] = None,
    role_arn: Optional[IamRoleArn] = None,
    display_configuration: Optional[DisplayConfiguration] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateStreamUrlOutput

Creates a stream URL that grants temporary access to a stream session in a web browser without requiring an Amazon Web Services account or client integration.

You can use the stream URL to start a stream session up to the number of times set by UsageLimit, until it expires after UrlExpiresAfterMinutes. Each successful use starts a new stream session.

To make the request idempotent, provide a ClientToken.

Parameters:

  • identifier (Identifier) –

    An Amazon Resource Name (ARN) or ID that uniquely identifies the stream group resource. Example ARN: arn:aws:gameliftstreams:us-west-2:111122223333:streamgroup/sg-1AB2C3De4. Example ID: sg-1AB2C3De4.

    The stream session runs in this stream group.

  • application_identifier (Identifier) –

    An Amazon Resource Name (ARN) or ID that uniquely identifies the application resource. Example ARN: arn:aws:gameliftstreams:us-west-2:111122223333:application/a-9ZY8X7Wv6. Example ID: a-9ZY8X7Wv6.

    This application must be associated with the stream group.

  • protocol (Protocol) –

    The data transport protocol for the stream session. Amazon GameLift Streams supports WebRTC.

  • url_expires_after_minutes (UrlExpiresAfterMinutes) –

    The number of minutes after creation that the stream URL remains valid. After this period, the status of the stream URL changes to EXPIRED and it can no longer start stream sessions. The minimum is 1 minute. For the maximum, see Regions, quotas, and limitations in the Amazon GameLift Streams Developer Guide.

  • usage_limit (Optional[UsageLimit], default: None ) –

    The maximum number of times the stream URL can start a stream session. Each successful use reduces the remaining uses by one. The minimum is 1, and the default is 1. For the maximum, see Regions, quotas, and limitations in the Amazon GameLift Streams Developer Guide.

  • description (Optional[Description], default: None ) –

    A descriptive label for the stream URL.

  • locations (LocationList) –

    A list of locations, in order of preference, where Amazon GameLift Streams can place the stream session. Specify each location by its Amazon Web Services Region code, for example us-east-1. For a complete list of locations that Amazon GameLift Streams supports, refer to Regions, quotas, and limitations in the Amazon GameLift Streams Developer Guide.

  • session_length_seconds (Optional[SessionLengthSeconds], default: None ) –

    The maximum length of time, in seconds, that a stream session started from this stream URL can run. Valid values are 1-86400 seconds (1 second to 24 hours). The default is 43200 seconds (12 hours).

  • additional_launch_args (Optional[GameLaunchArgList], default: None ) –

    A list of CLI arguments that are sent to the streaming server when a stream session launches. You can use this to configure the application or stream session details. You can also provide custom arguments that Amazon GameLift Streams passes to your game client.

    AdditionalEnvironmentVariables and AdditionalLaunchArgs have similar purposes. AdditionalEnvironmentVariables passes data using environment variables; while AdditionalLaunchArgs passes data using command-line arguments.

  • additional_environment_variables (Optional[EnvironmentVariables], default: None ) –

    A set of options that you can use to control the stream session runtime environment, expressed as a set of key-value pairs. You can use this to configure the application or stream session details. You can also provide custom environment variables that Amazon GameLift Streams passes to your game client.

    If you want to debug your application with environment variables, we recommend that you do so in a local environment outside of Amazon GameLift Streams. For more information, refer to the Compatibility Guidance in the troubleshooting section of the Developer Guide.

    AdditionalEnvironmentVariables and AdditionalLaunchArgs have similar purposes. AdditionalEnvironmentVariables passes data using environment variables; while AdditionalLaunchArgs passes data using command-line arguments.

  • role_arn (Optional[IamRoleArn], default: None ) –

    The Amazon Resource Name (ARN) of the IAM role that Amazon GameLift Streams assumes during stream sessions started from this stream URL. For more information, see Provide AWS credentials to your streaming application in the Amazon GameLift Streams Developer Guide.

  • display_configuration (Optional[DisplayConfiguration], default: None ) –

    The display settings, such as resolution, for stream sessions started from this stream URL.

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure this request is idempotent. If you retry a request with the same ClientToken, Amazon GameLift Streams returns the original response without performing the operation again.

Raises:

  • AccessDeniedException –

    You don't have the required permissions to access this Amazon GameLift Streams resource. Correct the permissions before you try again.

  • ConflictException –

    The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.

  • InternalServerException –

    The service encountered an internal error and is unable to complete the request.

  • ResourceNotFoundException –

    The resource specified in the request was not found. Correct the request before you try again.

  • ServiceQuotaExceededException –

    The request would cause the resource to exceed an allowed service quota. Resolve the issue before you try again.

  • ThrottlingException –

    The request was denied due to request throttling. Retry the request after the suggested wait time.

  • ValidationException –

    One or more parameter values in the request fail to satisfy the specified constraints. Correct the invalid parameter values before retrying the request.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_gameliftstreams/_services/game_lift_streams.py
def create_stream_url(
    self,
    identifier: "capo_gameliftstreams.types.identifier.Identifier",
    application_identifier: "capo_gameliftstreams.types.identifier.Identifier",
    protocol: "capo_gameliftstreams.types.protocol.Protocol",
    url_expires_after_minutes: "capo_gameliftstreams.types.url_expires_after_minutes.UrlExpiresAfterMinutes",
    locations: "capo_gameliftstreams.types.location_list.LocationList",
    *,
    config_overrides: Optional[GameLiftStreamsClientConfig] = None,
    usage_limit: Optional[
        "capo_gameliftstreams.types.usage_limit.UsageLimit"
    ] = None,
    description: Optional[
        "capo_gameliftstreams.types.description.Description"
    ] = None,
    session_length_seconds: Optional[
        "capo_gameliftstreams.types.session_length_seconds.SessionLengthSeconds"
    ] = None,
    additional_launch_args: Optional[
        "capo_gameliftstreams.types.game_launch_arg_list.GameLaunchArgList"
    ] = None,
    additional_environment_variables: Optional[
        "capo_gameliftstreams.types.environment_variables.EnvironmentVariables"
    ] = None,
    role_arn: Optional["capo_gameliftstreams.types.iam_role_arn.IamRoleArn"] = None,
    display_configuration: Optional[
        "capo_gameliftstreams.types.display_configuration.DisplayConfiguration"
    ] = None,
    client_token: Optional[
        "capo_gameliftstreams.types.client_token.ClientToken"
    ] = None,
) -> "capo_gameliftstreams.types.create_stream_url_output.CreateStreamUrlOutput":
    """<p>Creates a stream URL that grants temporary access to a stream session in a web browser without requiring an Amazon Web Services account or client integration.</p> <p>You can use the stream URL to start a stream session up to the number of times set by <code>UsageLimit</code>, until it expires after <code>UrlExpiresAfterMinutes</code>. Each successful use starts a new stream session.</p> <p>To make the request idempotent, provide a <code>ClientToken</code>.</p>

    Args:
        identifier: <p>An <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html">Amazon Resource Name (ARN)</a> or ID that uniquely identifies the stream group resource. Example ARN: <code>arn:aws:gameliftstreams:us-west-2:111122223333:streamgroup/sg-1AB2C3De4</code>. Example ID: <code>sg-1AB2C3De4</code>. </p> <p>The stream session runs in this stream group.</p>
        application_identifier: <p>An <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html">Amazon Resource Name (ARN)</a> or ID that uniquely identifies the application resource. Example ARN: <code>arn:aws:gameliftstreams:us-west-2:111122223333:application/a-9ZY8X7Wv6</code>. Example ID: <code>a-9ZY8X7Wv6</code>. </p> <p>This application must be associated with the stream group.</p>
        protocol: <p>The data transport protocol for the stream session. Amazon GameLift Streams supports <code>WebRTC</code>.</p>
        url_expires_after_minutes: <p>The number of minutes after creation that the stream URL remains valid. After this period, the status of the stream URL changes to <code>EXPIRED</code> and it can no longer start stream sessions. The minimum is 1 minute. For the maximum, see <a href="https://docs.aws.amazon.com/gameliftstreams/latest/developerguide/regions-quotas.html">Regions, quotas, and limitations</a> in the <i>Amazon GameLift Streams Developer Guide</i>.</p>
        usage_limit: <p>The maximum number of times the stream URL can start a stream session. Each successful use reduces the remaining uses by one. The minimum is 1, and the default is 1. For the maximum, see <a href="https://docs.aws.amazon.com/gameliftstreams/latest/developerguide/regions-quotas.html">Regions, quotas, and limitations</a> in the <i>Amazon GameLift Streams Developer Guide</i>.</p>
        description: <p>A descriptive label for the stream URL.</p>
        locations: <p>A list of locations, in order of preference, where Amazon GameLift Streams can place the stream session. Specify each location by its Amazon Web Services Region code, for example <code>us-east-1</code>. For a complete list of locations that Amazon GameLift Streams supports, refer to <a href="https://docs.aws.amazon.com/gameliftstreams/latest/developerguide/regions-quotas.html">Regions, quotas, and limitations</a> in the <i>Amazon GameLift Streams Developer Guide</i>. </p>
        session_length_seconds: <p>The maximum length of time, in seconds, that a stream session started from this stream URL can run. Valid values are 1-86400 seconds (1 second to 24 hours). The default is 43200 seconds (12 hours).</p>
        additional_launch_args: <p>A list of CLI arguments that are sent to the streaming server when a stream session launches. You can use this to configure the application or stream session details. You can also provide custom arguments that Amazon GameLift Streams passes to your game client.</p> <p> <code>AdditionalEnvironmentVariables</code> and <code>AdditionalLaunchArgs</code> have similar purposes. <code>AdditionalEnvironmentVariables</code> passes data using environment variables; while <code>AdditionalLaunchArgs</code> passes data using command-line arguments.</p>
        additional_environment_variables: <p>A set of options that you can use to control the stream session runtime environment, expressed as a set of key-value pairs. You can use this to configure the application or stream session details. You can also provide custom environment variables that Amazon GameLift Streams passes to your game client.</p> <note> <p>If you want to debug your application with environment variables, we recommend that you do so in a local environment outside of Amazon GameLift Streams. For more information, refer to the Compatibility Guidance in the troubleshooting section of the Developer Guide.</p> </note> <p> <code>AdditionalEnvironmentVariables</code> and <code>AdditionalLaunchArgs</code> have similar purposes. <code>AdditionalEnvironmentVariables</code> passes data using environment variables; while <code>AdditionalLaunchArgs</code> passes data using command-line arguments.</p>
        role_arn: <p>The Amazon Resource Name (ARN) of the IAM role that Amazon GameLift Streams assumes during stream sessions started from this stream URL. For more information, see <a href="https://docs.aws.amazon.com/gameliftstreams/latest/developerguide/session-credentials.html">Provide AWS credentials to your streaming application</a> in the <i>Amazon GameLift Streams Developer Guide</i>.</p>
        display_configuration: <p>The display settings, such as resolution, for stream sessions started from this stream URL.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure this request is idempotent. If you retry a request with the same <code>ClientToken</code>, Amazon GameLift Streams returns the original response without performing the operation again.</p>

    Raises:
        capo_gameliftstreams.errors.access_denied_exception.AccessDeniedException: <p>You don't have the required permissions to access this Amazon GameLift Streams resource. Correct the permissions before you try again.</p>
        capo_gameliftstreams.errors.conflict_exception.ConflictException: <p>The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.</p>
        capo_gameliftstreams.errors.internal_server_exception.InternalServerException: <p>The service encountered an internal error and is unable to complete the request.</p>
        capo_gameliftstreams.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request was not found. Correct the request before you try again.</p>
        capo_gameliftstreams.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would cause the resource to exceed an allowed service quota. Resolve the issue before you try again.</p>
        capo_gameliftstreams.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Retry the request after the suggested wait time.</p>
        capo_gameliftstreams.errors.validation_exception.ValidationException: <p>One or more parameter values in the request fail to satisfy the specified constraints. Correct the invalid parameter values before retrying the request.</p>
        capo_gameliftstreams.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_gameliftstreams.types.create_stream_url_input.CreateStreamUrlInput]",
    ) -> OperationResponse[
        "capo_gameliftstreams.types.create_stream_url_output.CreateStreamUrlOutput"
    ]:
        import capo_gameliftstreams._operations.game_lift_streams.create_stream_url

        output, http_response = (
            capo_gameliftstreams._operations.game_lift_streams.create_stream_url.create_stream_url(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_gameliftstreams.types.create_stream_url_input.CreateStreamUrlInput",
    ) -> dict[str, Any]:
        import capo_gameliftstreams.types.create_stream_url_input

        return capo_gameliftstreams.types.create_stream_url_input.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_gameliftstreams.types.create_stream_url_output.CreateStreamUrlOutput",
    ) -> dict[str, Any]:
        import capo_gameliftstreams.types.create_stream_url_output

        return capo_gameliftstreams.types.create_stream_url_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateStreamUrl",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_gameliftstreams.types.create_stream_url_input.CreateStreamUrlInput = {
        "identifier": identifier,
        "application_identifier": application_identifier,
        "protocol": protocol,
        "url_expires_after_minutes": url_expires_after_minutes,
        "locations": locations,
    }
    if usage_limit is not None:
        input_["usage_limit"] = usage_limit
    if description is not None:
        input_["description"] = description
    if session_length_seconds is not None:
        input_["session_length_seconds"] = session_length_seconds
    if additional_launch_args is not None:
        input_["additional_launch_args"] = additional_launch_args
    if additional_environment_variables is not None:
        input_["additional_environment_variables"] = (
            additional_environment_variables
        )
    if role_arn is not None:
        input_["role_arn"] = role_arn
    if display_configuration is not None:
        input_["display_configuration"] = display_configuration
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output