createApplication method
Creates an application resource in Amazon GameLift Streams, which specifies the application content you want to stream, such as a game build or other software, and configures the settings to run it.
Before you create an application, upload your application content files to
an Amazon Simple Storage Service (Amazon S3) bucket. For more information,
see Getting Started in the Amazon GameLift Streams Developer Guide.
If the request is successful, Amazon GameLift Streams begins to create an
application and sets the status to INITIALIZED. When an
application reaches READY status, you can use the application
to set up stream groups and start streams. To track application status,
call GetApplication.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter applicationSourceUri :
The location of the content that you want to stream. Enter an Amazon S3
URI to a bucket that contains your game or other application. The location
can have a multi-level prefix structure, but it must include all the files
needed to run the content. Amazon GameLift Streams copies everything under
the specified location.
This value is immutable. To designate a different content location, create a new application.
Parameter description :
A human-readable label for the application. You can update this value
later.
Parameter executablePath :
The relative path and file name of the executable file that Amazon
GameLift Streams will stream. Specify a path relative to the location set
in ApplicationSourceUri. The file must be contained within
the application's root folder. For Windows applications, the file must be
a valid Windows executable or batch file with a filename ending in .exe,
.cmd, or .bat. For Linux applications, the file must be a valid Linux
binary executable or a script that contains an initial interpreter line
starting with a shebang ('#!').
Parameter runtimeEnvironment :
Configuration settings that identify the operating system for an
application resource. This can also include a compatibility layer and
other drivers.
A runtime environment can be one of the following:
-
For Linux applications
-
Ubuntu 22.04 LTS (
Type=UBUNTU, Version=22_04_LTS)
-
Ubuntu 22.04 LTS (
-
For Windows applications
-
Microsoft Windows Server 2022 Base (
Type=WINDOWS, Version=2022) -
Proton 10.0-4 (
Type=PROTON, Version=20260204) -
Proton 9.0-2 (
Type=PROTON, Version=20250516) -
Proton 8.0-5 (
Type=PROTON, Version=20241007) -
Proton 8.0-2c (
Type=PROTON, Version=20230704)
-
Microsoft Windows Server 2022 Base (
Parameter applicationLogOutputUri :
An Amazon S3 URI to a bucket where you would like Amazon GameLift Streams
to save application logs. Required if you specify one or more
ApplicationLogPaths.
Parameter applicationLogPaths :
Locations of log files that your content generates during a stream
session. Enter path values that are relative to the
ApplicationSourceUri location, or relative to the user's home
directory when using a supported path variable. You can specify up to 10
log paths. Each individual log file cannot exceed 50 MB in size.
Each path can be a directory or an exact file path. When you specify a
directory, Amazon GameLift Streams collects only files with the following
extensions: .txt, .log, and
.utrace. To collect files with other extensions, specify the
exact file path. The copy operation is not performed recursively in
subfolders.
The following path variables are recognized when they appear as the first
component of a path: %USERPROFILE% (Windows and Proton),
$HOME or ~ (Linux). Use a path variable when
your application writes logs outside of the application directory.
Amazon GameLift Streams uploads designated log files to the Amazon S3
bucket that you specify in ApplicationLogOutputUri at the end
of a stream session. To retrieve stored log files, call GetStreamSession
and get the LogFileLocationUri.
Parameter clientToken :
A unique identifier that represents a client request. The request is
idempotent, which ensures that an API request completes only once. When
users send a request, Amazon GameLift Streams automatically populates this
field.
Parameter tags :
A list of labels to assign to the new application resource. Tags are
developer-defined key-value pairs. Tagging Amazon Web Services resources
is useful for resource management, access management and cost allocation.
See
Tagging Amazon Web Services Resources in the Amazon Web Services
General Reference. You can use TagResource
to add tags, UntagResource
to remove tags, and ListTagsForResource
to view tags on existing resources.
Implementation
Future<CreateApplicationOutput> createApplication({
required String applicationSourceUri,
required String description,
required String executablePath,
required RuntimeEnvironment runtimeEnvironment,
String? applicationLogOutputUri,
List<String>? applicationLogPaths,
String? clientToken,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'ApplicationSourceUri': applicationSourceUri,
'Description': description,
'ExecutablePath': executablePath,
'RuntimeEnvironment': runtimeEnvironment,
if (applicationLogOutputUri != null)
'ApplicationLogOutputUri': applicationLogOutputUri,
if (applicationLogPaths != null)
'ApplicationLogPaths': applicationLogPaths,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
if (tags != null) 'Tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/applications',
exceptionFnMap: _exceptionFns,
);
return CreateApplicationOutput.fromJson(response);
}