# Amazon GameLift Construct Library

> Version 2.278.0-alpha.0

> **Separate package**
>
> `@aws-cdk/aws-gamelift-alpha` is not part of `aws-cdk-lib` — install it separately:
>
> ```sh
> npm install @aws-cdk/aws-gamelift-alpha
> pip install aws-cdk.aws-gamelift-alpha
> ```
>
> This module is [**experimental**](https://docs.aws.amazon.com/cdk/api/stability.html) (alpha): its API may change in any release, without a major version bump.
---

![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)

> The APIs of higher level constructs in this module are experimental and under active development.
> They are subject to non-backward compatible changes or removal in any future version. These are
> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be
> announced in the release notes. This means that while you may use them, you may need to update
> your source code when upgrading to a newer version of this package.

---

[Amazon GameLift](https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-intro.html) is a service used
to deploy, operate, and scale dedicated, low-cost servers in the cloud for session-based multiplayer games. Built
on AWS global computing infrastructure, GameLift helps deliver high-performance, high-reliability game servers
while dynamically scaling your resource usage to meet worldwide player demand.

GameLift is composed of three main components:

* GameLift FlexMatch which is a customizable matchmaking service for
multiplayer games. With FlexMatch, you can
build a custom set of rules that defines what a multiplayer match looks like
for your game, and determines how to
evaluate and select compatible players for each match. You can also customize
key aspects of the matchmaking
process to fit your game, including fine-tuning the matching algorithm.

* GameLift hosting for custom or realtime servers which helps you deploy,
operate, and scale dedicated game servers. It regulates the resources needed to
host games, finds available game servers to host new game sessions, and puts
players into games.

* GameLift FleetIQ to optimize the use of low-cost Amazon Elastic Compute Cloud
(Amazon EC2) Spot Instances for cloud-based game hosting. With GameLift
FleetIQ, you can work directly with your hosting resources in Amazon EC2 and
Amazon EC2 Auto Scaling while taking advantage of GameLift optimizations to
deliver inexpensive, resilient game hosting for your players

This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project. It allows you to define components for your matchmaking
configuration or game server fleet management system.

## GameLift FlexMatch

### Defining a Matchmaking configuration

FlexMatch is available both as a GameLift game hosting solution (including
Realtime Servers) and as a standalone matchmaking service. To set up a
FlexMatch matchmaker to process matchmaking requests, you have to create a
matchmaking configuration based on a RuleSet.

More details about matchmaking ruleSet are covered [below](#matchmaking-ruleset).

There is two types of Matchmaking configuration:

Through a game session queue system to let FlexMatch forms matches and uses the specified GameLift queue to start a game session for the match.

TypeScript:

```ts
declare const queue: gamelift.GameSessionQueue;
declare const ruleSet: gamelift.MatchmakingRuleSet;

new gamelift.QueuedMatchmakingConfiguration(this, 'QueuedMatchmakingConfiguration', {
  matchmakingConfigurationName: 'test-queued-config-name',
  gameSessionQueues: [queue],
  ruleSet: ruleSet,
});
```

Python:

```python
# queue: gamelift.GameSessionQueue
# rule_set: gamelift.MatchmakingRuleSet

gamelift.QueuedMatchmakingConfiguration(self, "QueuedMatchmakingConfiguration",
    matchmaking_configuration_name="test-queued-config-name",
    game_session_queues=[queue],
    rule_set=rule_set
)
```

Java:

```java
GameSessionQueue queue;
MatchmakingRuleSet ruleSet;

QueuedMatchmakingConfiguration.Builder.create(this, "QueuedMatchmakingConfiguration")
        .matchmakingConfigurationName("test-queued-config-name")
        .gameSessionQueues(List.of(queue))
        .ruleSet(ruleSet)
        .build();
```

C# / .NET:

```csharp
GameSessionQueue queue;
MatchmakingRuleSet ruleSet;

new QueuedMatchmakingConfiguration(this, "QueuedMatchmakingConfiguration", new QueuedMatchmakingConfigurationProps {
    MatchmakingConfigurationName = "test-queued-config-name",
    GameSessionQueues = new [] { queue },
    RuleSet = ruleSet
});
```

Golang:

```go
var queue GameSessionQueue
var ruleSet MatchmakingRuleSet

gamelift.NewQueuedMatchmakingConfiguration(this, jsii.String("QueuedMatchmakingConfiguration"), &QueuedMatchmakingConfigurationProps{
	MatchmakingConfigurationName: jsii.String("test-queued-config-name"),
	GameSessionQueues: []IGameSessionQueue{
		queue,
	},
	RuleSet: ruleSet,
})
```

Or through a standalone version to let FlexMatch forms matches and returns match information in an event.

TypeScript:

```ts
declare const ruleSet: gamelift.MatchmakingRuleSet;

new gamelift.StandaloneMatchmakingConfiguration(this, 'StandaloneMatchmaking', {
  matchmakingConfigurationName: 'test-standalone-config-name',
  ruleSet: ruleSet,
});
```

Python:

```python
# rule_set: gamelift.MatchmakingRuleSet

gamelift.StandaloneMatchmakingConfiguration(self, "StandaloneMatchmaking",
    matchmaking_configuration_name="test-standalone-config-name",
    rule_set=rule_set
)
```

Java:

```java
MatchmakingRuleSet ruleSet;

StandaloneMatchmakingConfiguration.Builder.create(this, "StandaloneMatchmaking")
        .matchmakingConfigurationName("test-standalone-config-name")
        .ruleSet(ruleSet)
        .build();
```

C# / .NET:

```csharp
MatchmakingRuleSet ruleSet;

new StandaloneMatchmakingConfiguration(this, "StandaloneMatchmaking", new StandaloneMatchmakingConfigurationProps {
    MatchmakingConfigurationName = "test-standalone-config-name",
    RuleSet = ruleSet
});
```

Golang:

```go
var ruleSet MatchmakingRuleSet

gamelift.NewStandaloneMatchmakingConfiguration(this, jsii.String("StandaloneMatchmaking"), &StandaloneMatchmakingConfigurationProps{
	MatchmakingConfigurationName: jsii.String("test-standalone-config-name"),
	RuleSet: ruleSet,
})
```

More details about Game session queue are covered [below](#game-session-queue).

### Matchmaking RuleSet

Every FlexMatch matchmaker must have a rule set. The rule set determines the
two key elements of a match: your game's team structure and size, and how to
group players together for the best possible match.

For example, a rule set might describe a match like this: Create a match with
two teams of four to eight players each, one team is the cowboy and the other
team the aliens. A team can have novice and experienced players, but the
average skill of the two teams must be within 10 points of each other. If no
match is made after 30 seconds, gradually relax the skill requirements.

TypeScript:

```ts
new gamelift.MatchmakingRuleSet(this, 'RuleSet', {
  matchmakingRuleSetName: 'my-test-ruleset',
  content: gamelift.RuleSetContent.fromJsonFile(path.join(__dirname, 'my-ruleset', 'ruleset.json')),
});
```

Python:

```python
gamelift.MatchmakingRuleSet(self, "RuleSet",
    matchmaking_rule_set_name="my-test-ruleset",
    content=gamelift.RuleSetContent.from_json_file(path.join(__dirname, "my-ruleset", "ruleset.json"))
)
```

Java:

```java
MatchmakingRuleSet.Builder.create(this, "RuleSet")
        .matchmakingRuleSetName("my-test-ruleset")
        .content(RuleSetContent.fromJsonFile(join(__dirname, "my-ruleset", "ruleset.json")))
        .build();
```

C# / .NET:

```csharp
new MatchmakingRuleSet(this, "RuleSet", new MatchmakingRuleSetProps {
    MatchmakingRuleSetName = "my-test-ruleset",
    Content = RuleSetContent.FromJsonFile(Join(__dirname, "my-ruleset", "ruleset.json"))
});
```

Golang:

```go
gamelift.NewMatchmakingRuleSet(this, jsii.String("RuleSet"), &MatchmakingRuleSetProps{
	MatchmakingRuleSetName: jsii.String("my-test-ruleset"),
	Content: gamelift.RuleSetContent_FromJsonFile(path.join(__dirname, jsii.String("my-ruleset"), jsii.String("ruleset.json"))),
})
```

### FlexMatch Monitoring

You can monitor GameLift FlexMatch activity for matchmaking configurations and
matchmaking rules using Amazon CloudWatch. These statistics are used to provide
a historical perspective on how your Gamelift FlexMatch solution is performing.

#### FlexMatch Metrics

GameLift FlexMatch sends metrics to CloudWatch so that you can collect and
analyze the activity of your matchmaking solution, including match acceptance
workflow, ticket consumtion.

You can then use CloudWatch alarms to alert you, for example, when matches has
been rejected (potential matches that were rejected by at least one player
since the last report) exceed a certain thresold which could means that you may
have an issue in your matchmaking rules.

CDK provides methods for accessing GameLift FlexMatch metrics with default configuration,
such as `metricRuleEvaluationsPassed`, or `metricRuleEvaluationsFailed` (see
[`IMatchmakingRuleSet`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-gamelift.IMatchmakingRuleSet.html)
for a full list). CDK also provides a generic `metric` method that can be used
to produce metric configurations for any metric provided by GameLift FlexMatch;
the configurations are pre-populated with the correct dimensions for the
matchmaking configuration.

TypeScript:

```ts
declare const matchmakingRuleSet: gamelift.MatchmakingRuleSet;
// Alarm that triggers when the per-second average of not placed matches exceed 10%
const ruleEvaluationRatio = new cloudwatch.MathExpression({
  expression: '1 - (ruleEvaluationsPassed / ruleEvaluationsFailed)',
  usingMetrics: {
    ruleEvaluationsPassed: matchmakingRuleSet.metricRuleEvaluationsPassed({ statistic: cloudwatch.Statistic.SUM }),
    ruleEvaluationsFailed: matchmakingRuleSet.metric('ruleEvaluationsFailed'),
  },
});
new cloudwatch.Alarm(this, 'Alarm', {
  metric: ruleEvaluationRatio,
  threshold: 0.1,
  evaluationPeriods: 3,
});
```

Python:

```python
# matchmaking_rule_set: gamelift.MatchmakingRuleSet

# Alarm that triggers when the per-second average of not placed matches exceed 10%
rule_evaluation_ratio = cloudwatch.MathExpression(
    expression="1 - (ruleEvaluationsPassed / ruleEvaluationsFailed)",
    using_metrics={
        "rule_evaluations_passed": matchmaking_rule_set.metric_rule_evaluations_passed(statistic=cloudwatch.Statistic.SUM),
        "rule_evaluations_failed": matchmaking_rule_set.metric("ruleEvaluationsFailed")
    }
)
cloudwatch.Alarm(self, "Alarm",
    metric=rule_evaluation_ratio,
    threshold=0.1,
    evaluation_periods=3
)
```

Java:

```java
MatchmakingRuleSet matchmakingRuleSet;

// Alarm that triggers when the per-second average of not placed matches exceed 10%
MathExpression ruleEvaluationRatio = MathExpression.Builder.create()
        .expression("1 - (ruleEvaluationsPassed / ruleEvaluationsFailed)")
        .usingMetrics(Map.of(
                "ruleEvaluationsPassed", matchmakingRuleSet.metricRuleEvaluationsPassed(MetricOptions.builder().statistic(Statistic.SUM).build()),
                "ruleEvaluationsFailed", matchmakingRuleSet.metric("ruleEvaluationsFailed")))
        .build();
Alarm.Builder.create(this, "Alarm")
        .metric(ruleEvaluationRatio)
        .threshold(0.1)
        .evaluationPeriods(3)
        .build();
```

C# / .NET:

```csharp
MatchmakingRuleSet matchmakingRuleSet;

// Alarm that triggers when the per-second average of not placed matches exceed 10%
var ruleEvaluationRatio = new MathExpression(new MathExpressionProps {
    Expression = "1 - (ruleEvaluationsPassed / ruleEvaluationsFailed)",
    UsingMetrics = new Dictionary<string, IMetric> {
        { "ruleEvaluationsPassed", matchmakingRuleSet.MetricRuleEvaluationsPassed(new MetricOptions { Statistic = Statistic.SUM }) },
        { "ruleEvaluationsFailed", matchmakingRuleSet.Metric("ruleEvaluationsFailed") }
    }
});
new Alarm(this, "Alarm", new AlarmProps {
    Metric = ruleEvaluationRatio,
    Threshold = 0.1,
    EvaluationPeriods = 3
});
```

Golang:

```go
var matchmakingRuleSet MatchmakingRuleSet

// Alarm that triggers when the per-second average of not placed matches exceed 10%
ruleEvaluationRatio := cloudwatch.NewMathExpression(&MathExpressionProps{
	Expression: jsii.String("1 - (ruleEvaluationsPassed / ruleEvaluationsFailed)"),
	UsingMetrics: map[string]IMetric{
		"ruleEvaluationsPassed": matchmakingRuleSet.metricRuleEvaluationsPassed(&MetricOptions{
			"statistic": cloudwatch.Statistic_SUM,
		}),
		"ruleEvaluationsFailed": matchmakingRuleSet.metric(jsii.String("ruleEvaluationsFailed")),
	},
})
cloudwatch.NewAlarm(this, jsii.String("Alarm"), &AlarmProps{
	Metric: ruleEvaluationRatio,
	Threshold: jsii.Number(0.1),
	EvaluationPeriods: jsii.Number(3),
})
```

See: [Monitoring Using CloudWatch Metrics](https://docs.aws.amazon.com/gamelift/latest/developerguide/monitoring-cloudwatch.html)
in the *Amazon GameLift Developer Guide*.

## GameLift Hosting

### Uploading builds and scripts to GameLift

Before deploying your GameLift-enabled multiplayer game servers for hosting with the GameLift service, you need to upload
your game server files. This section provides guidance on preparing and uploading custom game server build
files or Realtime Servers server script files. When you upload files, you create a GameLift build or script resource, which
you then deploy on fleets of hosting resources.

To troubleshoot fleet activation problems related to the server script, see [Debug GameLift fleet issues](https://docs.aws.amazon.com/gamelift/latest/developerguide/fleets-creating-debug.html).

#### Upload a custom server build to GameLift

Before uploading your configured game server to GameLift for hosting, package the game build files into a build directory.
This directory must include all components required to run your game servers and host game sessions, including the following:

* Game server binaries – The binary files required to run the game server. A build can include binaries for multiple game
servers built to run on the same platform. For a list of supported platforms, see [Download Amazon GameLift SDKs](https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-supported.html).

* Dependencies – Any dependent files that your game server executables require to run. Examples include assets, configuration
files, and dependent libraries.

* Install script – A script file to handle tasks that are required to fully install your game build on GameLift hosting
servers. Place this file at the root of the build directory. GameLift runs the install script as part of fleet creation.

You can set up any application in your build, including your install script, to access your resources securely on other AWS
services.

TypeScript:

```ts
declare const bucket: s3.Bucket;
const build = new gamelift.Build(this, 'Build', {
  content: gamelift.Content.fromBucket(bucket, "sample-asset-key")
});

new CfnOutput(this, 'BuildArn', { value: build.buildArn });
new CfnOutput(this, 'BuildId', { value: build.buildId });
```

Python:

```python
# bucket: s3.Bucket

build = gamelift.Build(self, "Build",
    content=gamelift.Content.from_bucket(bucket, "sample-asset-key")
)

CfnOutput(self, "BuildArn", value=build.build_arn)
CfnOutput(self, "BuildId", value=build.build_id)
```

Java:

```java
Bucket bucket;

Build build = Build.Builder.create(this, "Build")
        .content(Content.fromBucket(bucket, "sample-asset-key"))
        .build();

CfnOutput.Builder.create(this, "BuildArn").value(build.getBuildArn()).build();
CfnOutput.Builder.create(this, "BuildId").value(build.getBuildId()).build();
```

C# / .NET:

```csharp
Bucket bucket;

var build = new Build(this, "Build", new BuildProps {
    Content = Content.FromBucket(bucket, "sample-asset-key")
});

new CfnOutput(this, "BuildArn", new CfnOutputProps { Value = build.BuildArn });
new CfnOutput(this, "BuildId", new CfnOutputProps { Value = build.BuildId });
```

Golang:

```go
var bucket Bucket

build := gamelift.NewBuild(this, jsii.String("Build"), &BuildProps{
	Content: gamelift.Content_FromBucket(bucket, jsii.String("sample-asset-key")),
})

awscdk.NewCfnOutput(this, jsii.String("BuildArn"), &CfnOutputProps{
	Value: build.buildArn,
})
awscdk.NewCfnOutput(this, jsii.String("BuildId"), &CfnOutputProps{
	Value: build.buildId,
})
```

To specify a server SDK version you used when integrating your game server build with Amazon GameLift use the `serverSdkVersion` parameter:

> See [Integrate games with custom game servers](https://docs.aws.amazon.com/gamelift/latest/developerguide/integration-custom-intro.html) for more details.

TypeScript:

```ts
declare const bucket: s3.Bucket;
const build = new gamelift.Build(this, 'Build', {
  content: gamelift.Content.fromBucket(bucket, "sample-asset-key"),
  serverSdkVersion: '5.0.0',
});
```

Python:

```python
# bucket: s3.Bucket

build = gamelift.Build(self, "Build",
    content=gamelift.Content.from_bucket(bucket, "sample-asset-key"),
    server_sdk_version="5.0.0"
)
```

Java:

```java
Bucket bucket;

Build build = Build.Builder.create(this, "Build")
        .content(Content.fromBucket(bucket, "sample-asset-key"))
        .serverSdkVersion("5.0.0")
        .build();
```

C# / .NET:

```csharp
Bucket bucket;

var build = new Build(this, "Build", new BuildProps {
    Content = Content.FromBucket(bucket, "sample-asset-key"),
    ServerSdkVersion = "5.0.0"
});
```

Golang:

```go
var bucket Bucket

build := gamelift.NewBuild(this, jsii.String("Build"), &BuildProps{
	Content: gamelift.Content_FromBucket(bucket, jsii.String("sample-asset-key")),
	ServerSdkVersion: jsii.String("5.0.0"),
})
```

#### Upload a realtime server Script

Your server script can include one or more files combined into a single .zip file for uploading. The .zip file must contain
all files that your script needs to run.

You can store your zipped script files in either a local file directory or in an Amazon Simple Storage Service (Amazon S3)
bucket or defines a directory asset which is archived as a .zip file and uploaded to S3 during deployment.

After you create the script resource, GameLift deploys the script with a new Realtime Servers fleet. GameLift installs your
server script onto each instance in the fleet, placing the script files in `/local/game`.

TypeScript:

```ts
declare const bucket: s3.Bucket;
new gamelift.Script(this, 'Script', {
  content: gamelift.Content.fromBucket(bucket, "sample-asset-key")
});
```

Python:

```python
# bucket: s3.Bucket

gamelift.Script(self, "Script",
    content=gamelift.Content.from_bucket(bucket, "sample-asset-key")
)
```

Java:

```java
Bucket bucket;

Script.Builder.create(this, "Script")
        .content(Content.fromBucket(bucket, "sample-asset-key"))
        .build();
```

C# / .NET:

```csharp
Bucket bucket;

new Script(this, "Script", new ScriptProps {
    Content = Content.FromBucket(bucket, "sample-asset-key")
});
```

Golang:

```go
var bucket Bucket

gamelift.NewScript(this, jsii.String("Script"), &ScriptProps{
	Content: gamelift.Content_FromBucket(bucket, jsii.String("sample-asset-key")),
})
```

### Defining a GameLift Fleet

#### Creating a custom game server fleet

Your uploaded game servers are hosted on GameLift virtual computing resources,
called instances. You set up your hosting resources by creating a fleet of
instances and deploying them to run your game servers. You can design a fleet
to fit your game's needs.

TypeScript:

```ts
new gamelift.BuildFleet(this, 'Game server fleet', {
  fleetName: 'test-fleet',
  content: gamelift.Build.fromAsset(this, 'Build', path.join(__dirname, 'CustomerGameServer')),
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
  runtimeConfiguration: {
    serverProcesses: [{
      launchPath: 'test-launch-path',
    }],
  },
});
```

Python:

```python
gamelift.BuildFleet(self, "Game server fleet",
    fleet_name="test-fleet",
    content=gamelift.Build.from_asset(self, "Build", path.join(__dirname, "CustomerGameServer")),
    instance_type=ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
    runtime_configuration=gamelift.RuntimeConfiguration(
        server_processes=[gamelift.ServerProcess(
            launch_path="test-launch-path"
        )]
    )
)
```

Java:

```java
BuildFleet.Builder.create(this, "Game server fleet")
        .fleetName("test-fleet")
        .content(Build.fromAsset(this, "Build", join(__dirname, "CustomerGameServer")))
        .instanceType(InstanceType.of(InstanceClass.C4, InstanceSize.LARGE))
        .runtimeConfiguration(RuntimeConfiguration.builder()
                .serverProcesses(List.of(ServerProcess.builder()
                        .launchPath("test-launch-path")
                        .build()))
                .build())
        .build();
```

C# / .NET:

```csharp
new BuildFleet(this, "Game server fleet", new BuildFleetProps {
    FleetName = "test-fleet",
    Content = Build.FromAsset(this, "Build", Join(__dirname, "CustomerGameServer")),
    InstanceType = InstanceType.Of(InstanceClass.C4, InstanceSize.LARGE),
    RuntimeConfiguration = new RuntimeConfiguration {
        ServerProcesses = new [] { new ServerProcess {
            LaunchPath = "test-launch-path"
        } }
    }
});
```

Golang:

```go
gamelift.NewBuildFleet(this, jsii.String("Game server fleet"), &BuildFleetProps{
	FleetName: jsii.String("test-fleet"),
	Content: gamelift.Build_FromAsset(this, jsii.String("Build"), path.join(__dirname, jsii.String("CustomerGameServer"))),
	InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_C4, ec2.InstanceSize_LARGE),
	RuntimeConfiguration: &RuntimeConfiguration{
		ServerProcesses: []ServerProcess{
			&ServerProcess{
				LaunchPath: jsii.String("test-launch-path"),
			},
		},
	},
})
```

### Managing game servers launch configuration

GameLift uses a fleet's runtime configuration to determine the type and number
of processes to run on each instance in the fleet. At a minimum, a runtime
configuration contains one server process configuration that represents one
game server executable. You can also define additional server process
configurations to run other types of processes related to your game. Each
server process configuration contains the following information:

* The file name and path of an executable in your game build.

* Optionally Parameters to pass to the process on launch.

* The number of processes to run concurrently.

A GameLift instance is limited to 50 processes running concurrently.

TypeScript:

```ts
declare const build: gamelift.Build;
// Server processes can be delcared in a declarative way through the constructor
const fleet = new gamelift.BuildFleet(this, 'Game server fleet', {
  fleetName: 'test-fleet',
  content: build,
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
  runtimeConfiguration: {
    serverProcesses: [{
      launchPath: '/local/game/GameLiftExampleServer.x86_64',
      parameters: '-logFile /local/game/logs/myserver1935.log -port 1935',
      concurrentExecutions: 100,
    }]
  }
});
```

Python:

```python
# build: gamelift.Build

# Server processes can be delcared in a declarative way through the constructor
fleet = gamelift.BuildFleet(self, "Game server fleet",
    fleet_name="test-fleet",
    content=build,
    instance_type=ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
    runtime_configuration=gamelift.RuntimeConfiguration(
        server_processes=[gamelift.ServerProcess(
            launch_path="/local/game/GameLiftExampleServer.x86_64",
            parameters="-logFile /local/game/logs/myserver1935.log -port 1935",
            concurrent_executions=100
        )]
    )
)
```

Java:

```java
Build build;

// Server processes can be delcared in a declarative way through the constructor
BuildFleet fleet = BuildFleet.Builder.create(this, "Game server fleet")
        .fleetName("test-fleet")
        .content(build)
        .instanceType(InstanceType.of(InstanceClass.C4, InstanceSize.LARGE))
        .runtimeConfiguration(RuntimeConfiguration.builder()
                .serverProcesses(List.of(ServerProcess.builder()
                        .launchPath("/local/game/GameLiftExampleServer.x86_64")
                        .parameters("-logFile /local/game/logs/myserver1935.log -port 1935")
                        .concurrentExecutions(100)
                        .build()))
                .build())
        .build();
```

C# / .NET:

```csharp
Build build;

// Server processes can be delcared in a declarative way through the constructor
var fleet = new BuildFleet(this, "Game server fleet", new BuildFleetProps {
    FleetName = "test-fleet",
    Content = build,
    InstanceType = InstanceType.Of(InstanceClass.C4, InstanceSize.LARGE),
    RuntimeConfiguration = new RuntimeConfiguration {
        ServerProcesses = new [] { new ServerProcess {
            LaunchPath = "/local/game/GameLiftExampleServer.x86_64",
            Parameters = "-logFile /local/game/logs/myserver1935.log -port 1935",
            ConcurrentExecutions = 100
        } }
    }
});
```

Golang:

```go
var build Build

// Server processes can be delcared in a declarative way through the constructor
fleet := gamelift.NewBuildFleet(this, jsii.String("Game server fleet"), &BuildFleetProps{
	FleetName: jsii.String("test-fleet"),
	Content: build,
	InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_C4, ec2.InstanceSize_LARGE),
	RuntimeConfiguration: &RuntimeConfiguration{
		ServerProcesses: []ServerProcess{
			&ServerProcess{
				LaunchPath: jsii.String("/local/game/GameLiftExampleServer.x86_64"),
				Parameters: jsii.String("-logFile /local/game/logs/myserver1935.log -port 1935"),
				ConcurrentExecutions: jsii.Number(100),
			},
		},
	},
})
```

See [Managing how game servers are launched for hosting](https://docs.aws.amazon.com/gamelift/latest/developerguide/fleets-multiprocess.html)
in the *Amazon GameLift Developer Guide*.

### Defining an instance type

GameLift uses Amazon Elastic Compute Cloud (Amazon EC2) resources, called
instances, to deploy your game servers and host game sessions for your players.
When setting up a new fleet, you decide what type of instances your game needs
and how to run game server processes on them (using a runtime configuration). All instances in a fleet use the same type of resources and the same runtime
configuration. You can edit a fleet's runtime configuration and other fleet
properties, but the type of resources cannot be changed.

TypeScript:

```ts
declare const build: gamelift.Build;
new gamelift.BuildFleet(this, 'Game server fleet', {
  fleetName: 'test-fleet',
  content: build,
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.C5, ec2.InstanceSize.LARGE),
  runtimeConfiguration: {
    serverProcesses: [{
      launchPath: '/local/game/GameLiftExampleServer.x86_64',
    }]
  }
});
```

Python:

```python
# build: gamelift.Build

gamelift.BuildFleet(self, "Game server fleet",
    fleet_name="test-fleet",
    content=build,
    instance_type=ec2.InstanceType.of(ec2.InstanceClass.C5, ec2.InstanceSize.LARGE),
    runtime_configuration=gamelift.RuntimeConfiguration(
        server_processes=[gamelift.ServerProcess(
            launch_path="/local/game/GameLiftExampleServer.x86_64"
        )]
    )
)
```

Java:

```java
Build build;

BuildFleet.Builder.create(this, "Game server fleet")
        .fleetName("test-fleet")
        .content(build)
        .instanceType(InstanceType.of(InstanceClass.C5, InstanceSize.LARGE))
        .runtimeConfiguration(RuntimeConfiguration.builder()
                .serverProcesses(List.of(ServerProcess.builder()
                        .launchPath("/local/game/GameLiftExampleServer.x86_64")
                        .build()))
                .build())
        .build();
```

C# / .NET:

```csharp
Build build;

new BuildFleet(this, "Game server fleet", new BuildFleetProps {
    FleetName = "test-fleet",
    Content = build,
    InstanceType = InstanceType.Of(InstanceClass.C5, InstanceSize.LARGE),
    RuntimeConfiguration = new RuntimeConfiguration {
        ServerProcesses = new [] { new ServerProcess {
            LaunchPath = "/local/game/GameLiftExampleServer.x86_64"
        } }
    }
});
```

Golang:

```go
var build Build

gamelift.NewBuildFleet(this, jsii.String("Game server fleet"), &BuildFleetProps{
	FleetName: jsii.String("test-fleet"),
	Content: build,
	InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_C5, ec2.InstanceSize_LARGE),
	RuntimeConfiguration: &RuntimeConfiguration{
		ServerProcesses: []ServerProcess{
			&ServerProcess{
				LaunchPath: jsii.String("/local/game/GameLiftExampleServer.x86_64"),
			},
		},
	},
})
```

### Using Spot instances

When setting up your hosting resources, you have the option of using Spot
Instances, On-Demand Instances, or a combination.

By default, fleet are using on demand capacity.

TypeScript:

```ts
declare const build: gamelift.Build;
new gamelift.BuildFleet(this, 'Game server fleet', {
  fleetName: 'test-fleet',
  content: build,
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
  runtimeConfiguration: {
    serverProcesses: [{
      launchPath: '/local/game/GameLiftExampleServer.x86_64',
    }]
  },
  useSpot: true
});
```

Python:

```python
# build: gamelift.Build

gamelift.BuildFleet(self, "Game server fleet",
    fleet_name="test-fleet",
    content=build,
    instance_type=ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
    runtime_configuration=gamelift.RuntimeConfiguration(
        server_processes=[gamelift.ServerProcess(
            launch_path="/local/game/GameLiftExampleServer.x86_64"
        )]
    ),
    use_spot=True
)
```

Java:

```java
Build build;

BuildFleet.Builder.create(this, "Game server fleet")
        .fleetName("test-fleet")
        .content(build)
        .instanceType(InstanceType.of(InstanceClass.C4, InstanceSize.LARGE))
        .runtimeConfiguration(RuntimeConfiguration.builder()
                .serverProcesses(List.of(ServerProcess.builder()
                        .launchPath("/local/game/GameLiftExampleServer.x86_64")
                        .build()))
                .build())
        .useSpot(true)
        .build();
```

C# / .NET:

```csharp
Build build;

new BuildFleet(this, "Game server fleet", new BuildFleetProps {
    FleetName = "test-fleet",
    Content = build,
    InstanceType = InstanceType.Of(InstanceClass.C4, InstanceSize.LARGE),
    RuntimeConfiguration = new RuntimeConfiguration {
        ServerProcesses = new [] { new ServerProcess {
            LaunchPath = "/local/game/GameLiftExampleServer.x86_64"
        } }
    },
    UseSpot = true
});
```

Golang:

```go
var build Build

gamelift.NewBuildFleet(this, jsii.String("Game server fleet"), &BuildFleetProps{
	FleetName: jsii.String("test-fleet"),
	Content: build,
	InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_C4, ec2.InstanceSize_LARGE),
	RuntimeConfiguration: &RuntimeConfiguration{
		ServerProcesses: []ServerProcess{
			&ServerProcess{
				LaunchPath: jsii.String("/local/game/GameLiftExampleServer.x86_64"),
			},
		},
	},
	UseSpot: jsii.Boolean(true),
})
```

### Allowing Ingress traffic

The allowed IP address ranges and port settings that allow inbound traffic to
access game sessions on this fleet.

New game sessions are assigned an IP address/port number combination, which
must fall into the fleet's allowed ranges. Fleets with custom game builds must
have permissions explicitly set. For Realtime Servers fleets, GameLift
automatically opens two port ranges, one for TCP messaging and one for UDP.

TypeScript:

```ts
declare const build: gamelift.Build;

const fleet = new gamelift.BuildFleet(this, 'Game server fleet', {
  fleetName: 'test-fleet',
  content: build,
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
  runtimeConfiguration: {
    serverProcesses: [{
      launchPath: '/local/game/GameLiftExampleServer.x86_64',
    }]
  },
  ingressRules: [{
    source: gamelift.Peer.anyIpv4(),
    port: gamelift.Port.tcpRange(100, 200),
  }]
});
// Allowing a specific CIDR for port 1111 on UDP Protocol
fleet.addIngressRule(gamelift.Peer.ipv4('1.2.3.4/32'), gamelift.Port.udp(1111));
```

Python:

```python
# build: gamelift.Build

fleet = gamelift.BuildFleet(self, "Game server fleet",
    fleet_name="test-fleet",
    content=build,
    instance_type=ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
    runtime_configuration=gamelift.RuntimeConfiguration(
        server_processes=[gamelift.ServerProcess(
            launch_path="/local/game/GameLiftExampleServer.x86_64"
        )]
    ),
    ingress_rules=[gamelift.IngressRule(
        source=gamelift.Peer.any_ipv4(),
        port=gamelift.Port.tcp_range(100, 200)
    )]
)
# Allowing a specific CIDR for port 1111 on UDP Protocol
fleet.add_ingress_rule(gamelift.Peer.ipv4("1.2.3.4/32"), gamelift.Port.udp(1111))
```

Java:

```java
Build build;

BuildFleet fleet = BuildFleet.Builder.create(this, "Game server fleet")
        .fleetName("test-fleet")
        .content(build)
        .instanceType(InstanceType.of(InstanceClass.C4, InstanceSize.LARGE))
        .runtimeConfiguration(RuntimeConfiguration.builder()
                .serverProcesses(List.of(ServerProcess.builder()
                        .launchPath("/local/game/GameLiftExampleServer.x86_64")
                        .build()))
                .build())
        .ingressRules(List.of(IngressRule.builder()
                .source(Peer.anyIpv4())
                .port(Port.tcpRange(100, 200))
                .build()))
        .build();
// Allowing a specific CIDR for port 1111 on UDP Protocol
fleet.addIngressRule(Peer.ipv4("1.2.3.4/32"), Port.udp(1111));
```

C# / .NET:

```csharp
Build build;

var fleet = new BuildFleet(this, "Game server fleet", new BuildFleetProps {
    FleetName = "test-fleet",
    Content = build,
    InstanceType = InstanceType.Of(InstanceClass.C4, InstanceSize.LARGE),
    RuntimeConfiguration = new RuntimeConfiguration {
        ServerProcesses = new [] { new ServerProcess {
            LaunchPath = "/local/game/GameLiftExampleServer.x86_64"
        } }
    },
    IngressRules = new [] { new IngressRule {
        Source = Peer.AnyIpv4(),
        Port = Port.TcpRange(100, 200)
    } }
});
// Allowing a specific CIDR for port 1111 on UDP Protocol
fleet.AddIngressRule(Peer.Ipv4("1.2.3.4/32"), Port.Udp(1111));
```

Golang:

```go
var build Build

fleet := gamelift.NewBuildFleet(this, jsii.String("Game server fleet"), &BuildFleetProps{
	FleetName: jsii.String("test-fleet"),
	Content: build,
	InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_C4, ec2.InstanceSize_LARGE),
	RuntimeConfiguration: &RuntimeConfiguration{
		ServerProcesses: []ServerProcess{
			&ServerProcess{
				LaunchPath: jsii.String("/local/game/GameLiftExampleServer.x86_64"),
			},
		},
	},
	IngressRules: []IngressRule{
		&IngressRule{
			Source: gamelift.Peer_AnyIpv4(),
			Port: gamelift.Port_TcpRange(jsii.Number(100), jsii.Number(200)),
		},
	},
})
// Allowing a specific CIDR for port 1111 on UDP Protocol
fleet.AddIngressRule(gamelift.Peer_Ipv4(jsii.String("1.2.3.4/32")), gamelift.Port_Udp(jsii.Number(1111)))
```

### Managing locations

A single Amazon GameLift fleet has a home Region by default (the Region you
deploy it to), but it can deploy resources to any number of GameLift supported
Regions. Select Regions based on where your players are located and your
latency needs.

By default, home region is used as default location but we can add new locations if needed and define desired capacity

TypeScript:

```ts
declare const build: gamelift.Build;

// Locations can be added directly through constructor
const fleet = new gamelift.BuildFleet(this, 'Game server fleet', {
  fleetName: 'test-fleet',
  content: build,
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
  runtimeConfiguration: {
    serverProcesses: [{
      launchPath: '/local/game/GameLiftExampleServer.x86_64',
    }]
  },
  locations: [ {
    region: 'eu-west-1',
    capacity: {
      desiredCapacity: 5,
      minSize: 2,
      maxSize: 10
    }
  }, {
    region: 'us-east-1',
    capacity: {
      desiredCapacity: 5,
      minSize: 2,
      maxSize: 10
    }
  }]
});

// Or through dedicated methods
fleet.addLocation('ap-southeast-1', 5, 2, 10);
```

Python:

```python
# build: gamelift.Build

# Locations can be added directly through constructor
fleet = gamelift.BuildFleet(self, "Game server fleet",
    fleet_name="test-fleet",
    content=build,
    instance_type=ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
    runtime_configuration=gamelift.RuntimeConfiguration(
        server_processes=[gamelift.ServerProcess(
            launch_path="/local/game/GameLiftExampleServer.x86_64"
        )]
    ),
    locations=[gamelift.Location(
        region="eu-west-1",
        capacity=gamelift.LocationCapacity(
            desired_capacity=5,
            min_size=2,
            max_size=10
        )
    ), gamelift.Location(
        region="us-east-1",
        capacity=gamelift.LocationCapacity(
            desired_capacity=5,
            min_size=2,
            max_size=10
        )
    )]
)

# Or through dedicated methods
fleet.add_location("ap-southeast-1", 5, 2, 10)
```

Java:

```java
Build build;

// Locations can be added directly through constructor
BuildFleet fleet = BuildFleet.Builder.create(this, "Game server fleet")
        .fleetName("test-fleet")
        .content(build)
        .instanceType(InstanceType.of(InstanceClass.C4, InstanceSize.LARGE))
        .runtimeConfiguration(RuntimeConfiguration.builder()
                .serverProcesses(List.of(ServerProcess.builder()
                        .launchPath("/local/game/GameLiftExampleServer.x86_64")
                        .build()))
                .build())
        .locations(List.of(Location.builder()
                .region("eu-west-1")
                .capacity(LocationCapacity.builder()
                        .desiredCapacity(5)
                        .minSize(2)
                        .maxSize(10)
                        .build())
                .build(), Location.builder()
                .region("us-east-1")
                .capacity(LocationCapacity.builder()
                        .desiredCapacity(5)
                        .minSize(2)
                        .maxSize(10)
                        .build())
                .build()))
        .build();

// Or through dedicated methods
fleet.addLocation("ap-southeast-1", 5, 2, 10);
```

C# / .NET:

```csharp
Build build;

// Locations can be added directly through constructor
var fleet = new BuildFleet(this, "Game server fleet", new BuildFleetProps {
    FleetName = "test-fleet",
    Content = build,
    InstanceType = InstanceType.Of(InstanceClass.C4, InstanceSize.LARGE),
    RuntimeConfiguration = new RuntimeConfiguration {
        ServerProcesses = new [] { new ServerProcess {
            LaunchPath = "/local/game/GameLiftExampleServer.x86_64"
        } }
    },
    Locations = new [] { new Location {
        Region = "eu-west-1",
        Capacity = new LocationCapacity {
            DesiredCapacity = 5,
            MinSize = 2,
            MaxSize = 10
        }
    }, new Location {
        Region = "us-east-1",
        Capacity = new LocationCapacity {
            DesiredCapacity = 5,
            MinSize = 2,
            MaxSize = 10
        }
    } }
});

// Or through dedicated methods
fleet.AddLocation("ap-southeast-1", 5, 2, 10);
```

Golang:

```go
var build Build

// Locations can be added directly through constructor
fleet := gamelift.NewBuildFleet(this, jsii.String("Game server fleet"), &BuildFleetProps{
	FleetName: jsii.String("test-fleet"),
	Content: build,
	InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_C4, ec2.InstanceSize_LARGE),
	RuntimeConfiguration: &RuntimeConfiguration{
		ServerProcesses: []ServerProcess{
			&ServerProcess{
				LaunchPath: jsii.String("/local/game/GameLiftExampleServer.x86_64"),
			},
		},
	},
	Locations: []Location{
		&Location{
			Region: jsii.String("eu-west-1"),
			Capacity: &LocationCapacity{
				DesiredCapacity: jsii.Number(5),
				MinSize: jsii.Number(2),
				MaxSize: jsii.Number(10),
			},
		},
		&Location{
			Region: jsii.String("us-east-1"),
			Capacity: &LocationCapacity{
				DesiredCapacity: jsii.Number(5),
				MinSize: jsii.Number(2),
				MaxSize: jsii.Number(10),
			},
		},
	},
})

// Or through dedicated methods
fleet.AddLocation(jsii.String("ap-southeast-1"), jsii.Number(5), jsii.Number(2), jsii.Number(10))
```

### Specifying an IAM role for a Fleet

Some GameLift features require you to extend limited access to your AWS
resources. This is done by creating an AWS IAM role. The GameLift Fleet class
automatically created an IAM role with all the minimum necessary permissions
for GameLift to access your resources. If you wish, you may
specify your own IAM role.

TypeScript:

```ts
declare const build: gamelift.Build;
const role = new iam.Role(this, 'Role', {
  assumedBy: new iam.CompositePrincipal(new iam.ServicePrincipal('gamelift.amazonaws.com'))
});
role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('CloudWatchAgentServerPolicy'));

const fleet = new gamelift.BuildFleet(this, 'Game server fleet', {
  fleetName: 'test-fleet',
  content: build,
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.C5, ec2.InstanceSize.LARGE),
  runtimeConfiguration: {
    serverProcesses: [{
      launchPath: '/local/game/GameLiftExampleServer.x86_64',
    }]
  },
  role: role
});

// Actions can also be grantted through dedicated method
fleet.grant(role, 'gamelift:ListFleets');
```

Python:

```python
# build: gamelift.Build

role = iam.Role(self, "Role",
    assumed_by=iam.CompositePrincipal(iam.ServicePrincipal("gamelift.amazonaws.com"))
)
role.add_managed_policy(iam.ManagedPolicy.from_aws_managed_policy_name("CloudWatchAgentServerPolicy"))

fleet = gamelift.BuildFleet(self, "Game server fleet",
    fleet_name="test-fleet",
    content=build,
    instance_type=ec2.InstanceType.of(ec2.InstanceClass.C5, ec2.InstanceSize.LARGE),
    runtime_configuration=gamelift.RuntimeConfiguration(
        server_processes=[gamelift.ServerProcess(
            launch_path="/local/game/GameLiftExampleServer.x86_64"
        )]
    ),
    role=role
)

# Actions can also be grantted through dedicated method
fleet.grant(role, "gamelift:ListFleets")
```

Java:

```java
Build build;

Role role = Role.Builder.create(this, "Role")
        .assumedBy(new CompositePrincipal(new ServicePrincipal("gamelift.amazonaws.com")))
        .build();
role.addManagedPolicy(ManagedPolicy.fromAwsManagedPolicyName("CloudWatchAgentServerPolicy"));

BuildFleet fleet = BuildFleet.Builder.create(this, "Game server fleet")
        .fleetName("test-fleet")
        .content(build)
        .instanceType(InstanceType.of(InstanceClass.C5, InstanceSize.LARGE))
        .runtimeConfiguration(RuntimeConfiguration.builder()
                .serverProcesses(List.of(ServerProcess.builder()
                        .launchPath("/local/game/GameLiftExampleServer.x86_64")
                        .build()))
                .build())
        .role(role)
        .build();

// Actions can also be grantted through dedicated method
fleet.grant(role, "gamelift:ListFleets");
```

C# / .NET:

```csharp
Build build;

var role = new Role(this, "Role", new RoleProps {
    AssumedBy = new CompositePrincipal(new ServicePrincipal("gamelift.amazonaws.com"))
});
role.AddManagedPolicy(ManagedPolicy.FromAwsManagedPolicyName("CloudWatchAgentServerPolicy"));

var fleet = new BuildFleet(this, "Game server fleet", new BuildFleetProps {
    FleetName = "test-fleet",
    Content = build,
    InstanceType = InstanceType.Of(InstanceClass.C5, InstanceSize.LARGE),
    RuntimeConfiguration = new RuntimeConfiguration {
        ServerProcesses = new [] { new ServerProcess {
            LaunchPath = "/local/game/GameLiftExampleServer.x86_64"
        } }
    },
    Role = role
});

// Actions can also be grantted through dedicated method
fleet.Grant(role, "gamelift:ListFleets");
```

Golang:

```go
var build Build

role := iam.NewRole(this, jsii.String("Role"), &RoleProps{
	AssumedBy: iam.NewCompositePrincipal(iam.NewServicePrincipal(jsii.String("gamelift.amazonaws.com"))),
})
role.AddManagedPolicy(iam.ManagedPolicy_FromAwsManagedPolicyName(jsii.String("CloudWatchAgentServerPolicy")))

fleet := gamelift.NewBuildFleet(this, jsii.String("Game server fleet"), &BuildFleetProps{
	FleetName: jsii.String("test-fleet"),
	Content: build,
	InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_C5, ec2.InstanceSize_LARGE),
	RuntimeConfiguration: &RuntimeConfiguration{
		ServerProcesses: []ServerProcess{
			&ServerProcess{
				LaunchPath: jsii.String("/local/game/GameLiftExampleServer.x86_64"),
			},
		},
	},
	Role: role,
})

// Actions can also be grantted through dedicated method
fleet.Grant(role, jsii.String("gamelift:ListFleets"))
```

### Alias

A GameLift alias is used to abstract a fleet designation. Fleet designations
tell Amazon GameLift where to search for available resources when creating new
game sessions for players. By using aliases instead of specific fleet IDs, you
can more easily and seamlessly switch player traffic from one fleet to another
by changing the alias's target location.

TypeScript:

```ts
declare const fleet: gamelift.BuildFleet;

// Add an alias to an existing fleet using a dedicated fleet method
const liveAlias = fleet.addAlias('live');

// You can also create a standalone alias
new gamelift.Alias(this, 'TerminalAlias', {
  aliasName: 'terminal-alias',
  terminalMessage: 'A terminal message',
});
```

Python:

```python
# fleet: gamelift.BuildFleet

# Add an alias to an existing fleet using a dedicated fleet method
live_alias = fleet.add_alias("live")

# You can also create a standalone alias
gamelift.Alias(self, "TerminalAlias",
    alias_name="terminal-alias",
    terminal_message="A terminal message"
)
```

Java:

```java
BuildFleet fleet;

// Add an alias to an existing fleet using a dedicated fleet method
Alias liveAlias = fleet.addAlias("live");

// You can also create a standalone alias
// You can also create a standalone alias
Alias.Builder.create(this, "TerminalAlias")
        .aliasName("terminal-alias")
        .terminalMessage("A terminal message")
        .build();
```

C# / .NET:

```csharp
BuildFleet fleet;

// Add an alias to an existing fleet using a dedicated fleet method
var liveAlias = fleet.AddAlias("live");

// You can also create a standalone alias
// You can also create a standalone alias
new Alias(this, "TerminalAlias", new AliasProps {
    AliasName = "terminal-alias",
    TerminalMessage = "A terminal message"
});
```

Golang:

```go
var fleet BuildFleet

// Add an alias to an existing fleet using a dedicated fleet method
liveAlias := fleet.AddAlias(jsii.String("live"))

// You can also create a standalone alias
// You can also create a standalone alias
gamelift.NewAlias(this, jsii.String("TerminalAlias"), &AliasProps{
	AliasName: jsii.String("terminal-alias"),
	TerminalMessage: jsii.String("A terminal message"),
})
```

See [Add an alias to a GameLift fleet](https://docs.aws.amazon.com/gamelift/latest/developerguide/aliases-creating.html)
in the *Amazon GameLift Developer Guide*.

### Monitoring your Fleet

GameLift is integrated with CloudWatch, so you can monitor the performance of
your game servers via logs and metrics.

#### Fleet Metrics

GameLift Fleet sends metrics to CloudWatch so that you can collect and analyze
the activity of your Fleet, including game  and player sessions and server
processes.

You can then use CloudWatch alarms to alert you, for example, when matches has
been rejected (potential matches that were rejected by at least one player
since the last report) exceed a certain threshold which could means that you may
have an issue in your matchmaking rules.

CDK provides methods for accessing GameLift Fleet metrics with default configuration,
such as `metricActiveInstances`, or `metricIdleInstances` (see [`IFleet`](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-gamelift.IFleet.html)
for a full list). CDK also provides a generic `metric` method that can be used
to produce metric configurations for any metric provided by GameLift Fleet,
Game sessions or server processes; the configurations are pre-populated with
the correct dimensions for the matchmaking configuration.

TypeScript:

```ts
declare const fleet: gamelift.BuildFleet;
// Alarm that triggers when the per-second average of not used instances exceed 10%
const instancesUsedRatio = new cloudwatch.MathExpression({
  expression: '1 - (activeInstances / idleInstances)',
  usingMetrics: {
    activeInstances: fleet.metric('ActiveInstances', { statistic: cloudwatch.Statistic.SUM }),
    idleInstances: fleet.metricIdleInstances(),
  },
});
new cloudwatch.Alarm(this, 'Alarm', {
  metric: instancesUsedRatio,
  threshold: 0.1,
  evaluationPeriods: 3,
});
```

Python:

```python
# fleet: gamelift.BuildFleet

# Alarm that triggers when the per-second average of not used instances exceed 10%
instances_used_ratio = cloudwatch.MathExpression(
    expression="1 - (activeInstances / idleInstances)",
    using_metrics={
        "active_instances": fleet.metric("ActiveInstances", statistic=cloudwatch.Statistic.SUM),
        "idle_instances": fleet.metric_idle_instances()
    }
)
cloudwatch.Alarm(self, "Alarm",
    metric=instances_used_ratio,
    threshold=0.1,
    evaluation_periods=3
)
```

Java:

```java
BuildFleet fleet;

// Alarm that triggers when the per-second average of not used instances exceed 10%
MathExpression instancesUsedRatio = MathExpression.Builder.create()
        .expression("1 - (activeInstances / idleInstances)")
        .usingMetrics(Map.of(
                "activeInstances", fleet.metric("ActiveInstances", MetricOptions.builder().statistic(Statistic.SUM).build()),
                "idleInstances", fleet.metricIdleInstances()))
        .build();
Alarm.Builder.create(this, "Alarm")
        .metric(instancesUsedRatio)
        .threshold(0.1)
        .evaluationPeriods(3)
        .build();
```

C# / .NET:

```csharp
BuildFleet fleet;

// Alarm that triggers when the per-second average of not used instances exceed 10%
var instancesUsedRatio = new MathExpression(new MathExpressionProps {
    Expression = "1 - (activeInstances / idleInstances)",
    UsingMetrics = new Dictionary<string, IMetric> {
        { "activeInstances", fleet.Metric("ActiveInstances", new MetricOptions { Statistic = Statistic.SUM }) },
        { "idleInstances", fleet.MetricIdleInstances() }
    }
});
new Alarm(this, "Alarm", new AlarmProps {
    Metric = instancesUsedRatio,
    Threshold = 0.1,
    EvaluationPeriods = 3
});
```

Golang:

```go
var fleet BuildFleet

// Alarm that triggers when the per-second average of not used instances exceed 10%
instancesUsedRatio := cloudwatch.NewMathExpression(&MathExpressionProps{
	Expression: jsii.String("1 - (activeInstances / idleInstances)"),
	UsingMetrics: map[string]IMetric{
		"activeInstances": fleet.metric(jsii.String("ActiveInstances"), &MetricOptions{
			"statistic": cloudwatch.Statistic_SUM,
		}),
		"idleInstances": fleet.metricIdleInstances(),
	},
})
cloudwatch.NewAlarm(this, jsii.String("Alarm"), &AlarmProps{
	Metric: instancesUsedRatio,
	Threshold: jsii.Number(0.1),
	EvaluationPeriods: jsii.Number(3),
})
```

See: [Monitoring Using CloudWatch Metrics](https://docs.aws.amazon.com/gamelift/latest/developerguide/monitoring-cloudwatch.html)
in the *Amazon GameLift Developer Guide*.

## Game session queue

The game session queue is the primary mechanism for processing new game session
requests and locating available game servers to host them. Although it is
possible to request a new game session be hosted on specific fleet or location.

The [`GameSessionQueue`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.GameSessionQueue.html) resource creates a placement queue that processes requests for
new game sessions. A queue uses FleetIQ algorithms to determine the best placement
locations and find an available game server, then prompts the game server to start a
new game session. Queues can have destinations (GameLift fleets or aliases), which
determine where the queue can place new game sessions. A queue can have destinations
with varied fleet type (Spot and On-Demand), instance type, and AWS Region.

TypeScript:

```ts
declare const fleet: gamelift.BuildFleet;
declare const alias: gamelift.Alias;

const queue = new gamelift.GameSessionQueue(this, 'GameSessionQueue', {
  gameSessionQueueName: 'my-queue-name',
  destinations: [fleet]
});
queue.addDestination(alias);
```

Python:

```python
# fleet: gamelift.BuildFleet
# alias: gamelift.Alias

queue = gamelift.GameSessionQueue(self, "GameSessionQueue",
    game_session_queue_name="my-queue-name",
    destinations=[fleet]
)
queue.add_destination(alias)
```

Java:

```java
BuildFleet fleet;
Alias alias;

GameSessionQueue queue = GameSessionQueue.Builder.create(this, "GameSessionQueue")
        .gameSessionQueueName("my-queue-name")
        .destinations(List.of(fleet))
        .build();
queue.addDestination(alias);
```

C# / .NET:

```csharp
BuildFleet fleet;
Alias alias;

var queue = new GameSessionQueue(this, "GameSessionQueue", new GameSessionQueueProps {
    GameSessionQueueName = "my-queue-name",
    Destinations = new [] { fleet }
});
queue.AddDestination(alias);
```

Golang:

```go
var fleet BuildFleet
var alias Alias

queue := gamelift.NewGameSessionQueue(this, jsii.String("GameSessionQueue"), &GameSessionQueueProps{
	GameSessionQueueName: jsii.String("my-queue-name"),
	Destinations: []IGameSessionQueueDestination{
		fleet,
	},
})
queue.AddDestination(alias)
```

A more complex configuration can also be definied to override how FleetIQ algorithms prioritize game session placement in order to favour a destination based on `Cost`, `Latency`, `Destination order`or [`Location`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.Location.html).

TypeScript:

```ts
declare const fleet: gamelift.BuildFleet;
declare const topic: sns.Topic;

new gamelift.GameSessionQueue(this, 'MyGameSessionQueue', {
      gameSessionQueueName: 'test-gameSessionQueue',
      customEventData: 'test-event-data',
      allowedLocations: ['eu-west-1', 'eu-west-2'],
      destinations: [fleet],
      notificationTarget: topic,
      playerLatencyPolicies: [{
        maximumIndividualPlayerLatency: Duration.millis(100),
        policyDuration: Duration.seconds(300),
      }],
      priorityConfiguration: {
        locationOrder: [
          'eu-west-1',
          'eu-west-2',
        ],
        priorityOrder: [
          gamelift.PriorityType.LATENCY,
          gamelift.PriorityType.COST,
          gamelift.PriorityType.DESTINATION,
          gamelift.PriorityType.LOCATION,
        ],
      },
      timeout: Duration.seconds(300),
    });
```

Python:

```python
# fleet: gamelift.BuildFleet
# topic: sns.Topic

gamelift.GameSessionQueue(self, "MyGameSessionQueue",
    game_session_queue_name="test-gameSessionQueue",
    custom_event_data="test-event-data",
    allowed_locations=["eu-west-1", "eu-west-2"],
    destinations=[fleet],
    notification_target=topic,
    player_latency_policies=[gamelift.PlayerLatencyPolicy(
        maximum_individual_player_latency=Duration.millis(100),
        policy_duration=Duration.seconds(300)
    )],
    priority_configuration=gamelift.PriorityConfiguration(
        location_order=["eu-west-1", "eu-west-2"
        ],
        priority_order=[gamelift.PriorityType.LATENCY, gamelift.PriorityType.COST, gamelift.PriorityType.DESTINATION, gamelift.PriorityType.LOCATION
        ]
    ),
    timeout=Duration.seconds(300)
)
```

Java:

```java
BuildFleet fleet;
Topic topic;

GameSessionQueue.Builder.create(this, "MyGameSessionQueue")
        .gameSessionQueueName("test-gameSessionQueue")
        .customEventData("test-event-data")
        .allowedLocations(List.of("eu-west-1", "eu-west-2"))
        .destinations(List.of(fleet))
        .notificationTarget(topic)
        .playerLatencyPolicies(List.of(PlayerLatencyPolicy.builder()
                .maximumIndividualPlayerLatency(Duration.millis(100))
                .policyDuration(Duration.seconds(300))
                .build()))
        .priorityConfiguration(PriorityConfiguration.builder()
                .locationOrder(List.of("eu-west-1", "eu-west-2"))
                .priorityOrder(List.of(PriorityType.LATENCY, PriorityType.COST, PriorityType.DESTINATION, PriorityType.LOCATION))
                .build())
        .timeout(Duration.seconds(300))
        .build();
```

C# / .NET:

```csharp
BuildFleet fleet;
Topic topic;

new GameSessionQueue(this, "MyGameSessionQueue", new GameSessionQueueProps {
    GameSessionQueueName = "test-gameSessionQueue",
    CustomEventData = "test-event-data",
    AllowedLocations = new [] { "eu-west-1", "eu-west-2" },
    Destinations = new [] { fleet },
    NotificationTarget = topic,
    PlayerLatencyPolicies = new [] { new PlayerLatencyPolicy {
        MaximumIndividualPlayerLatency = Duration.Millis(100),
        PolicyDuration = Duration.Seconds(300)
    } },
    PriorityConfiguration = new PriorityConfiguration {
        LocationOrder = new [] { "eu-west-1", "eu-west-2" },
        PriorityOrder = new [] { PriorityType.LATENCY, PriorityType.COST, PriorityType.DESTINATION, PriorityType.LOCATION }
    },
    Timeout = Duration.Seconds(300)
});
```

Golang:

```go
var fleet BuildFleet
var topic Topic

gamelift.NewGameSessionQueue(this, jsii.String("MyGameSessionQueue"), &GameSessionQueueProps{
	GameSessionQueueName: jsii.String("test-gameSessionQueue"),
	CustomEventData: jsii.String("test-event-data"),
	AllowedLocations: []*string{
		jsii.String("eu-west-1"),
		jsii.String("eu-west-2"),
	},
	Destinations: []IGameSessionQueueDestination{
		fleet,
	},
	NotificationTarget: topic,
	PlayerLatencyPolicies: []PlayerLatencyPolicy{
		&PlayerLatencyPolicy{
			MaximumIndividualPlayerLatency: awscdk.Duration_Millis(jsii.Number(100)),
			PolicyDuration: awscdk.Duration_Seconds(jsii.Number(300)),
		},
	},
	PriorityConfiguration: &PriorityConfiguration{
		LocationOrder: []*string{
			jsii.String("eu-west-1"),
			jsii.String("eu-west-2"),
		},
		PriorityOrder: []PriorityType{
			gamelift.PriorityType_LATENCY,
			gamelift.PriorityType_COST,
			gamelift.PriorityType_DESTINATION,
			gamelift.PriorityType_LOCATION,
		},
	},
	Timeout: awscdk.Duration_*Seconds(jsii.Number(300)),
})
```

See [Setting up GameLift queues for game session placement](https://docs.aws.amazon.com/gamelift/latest/developerguide/realtime-script-uploading.html)
in the *Amazon GameLift Developer Guide*.

## GameLift FleetIQ

The GameLift FleetIQ solution is a game hosting layer that supplements the full
set of computing resource management tools that you get with Amazon EC2 and
Auto Scaling. This solution lets you directly manage your Amazon EC2 and Auto
Scaling resources and integrate as needed with other AWS services.

### Defining a Game Server Group

When using GameLift FleetIQ, you prepare to launch Amazon EC2 instances as
usual: make an Amazon Machine Image (AMI) with your game server software,
create an Amazon EC2 launch template, and define configuration settings for an
Auto Scaling group. However, instead of creating an Auto Scaling group
directly, you create a GameLift FleetIQ game server group with your Amazon EC2
and Auto Scaling resources and configuration. All game server groups must have
at least two instance types defined for it.

Once a game server group and Auto Scaling group are up and running with
instances deployed, when updating a Game Server Group instance, only certain
properties in the Auto Scaling group may be overwrite. For all other Auto
Scaling group properties, such as MinSize, MaxSize, and LaunchTemplate, you can
modify these directly on the Auto Scaling group using the AWS Console or
dedicated Api.

TypeScript:

```ts
declare const launchTemplate: ec2.ILaunchTemplate;
declare const vpc: ec2.IVpc;

new gamelift.GameServerGroup(this, 'Game server group', {
  gameServerGroupName: 'sample-gameservergroup-name',
  instanceDefinitions: [{
    instanceType: ec2.InstanceType.of(ec2.InstanceClass.C5, ec2.InstanceSize.LARGE),
  },
  {
    instanceType: ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
  }],
  launchTemplate: launchTemplate,
  vpc: vpc
});
```

Python:

```python
# launch_template: ec2.ILaunchTemplate
# vpc: ec2.IVpc

gamelift.GameServerGroup(self, "Game server group",
    game_server_group_name="sample-gameservergroup-name",
    instance_definitions=[gamelift.InstanceDefinition(
        instance_type=ec2.InstanceType.of(ec2.InstanceClass.C5, ec2.InstanceSize.LARGE)
    ), gamelift.InstanceDefinition(
        instance_type=ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE)
    )],
    launch_template=launch_template,
    vpc=vpc
)
```

Java:

```java
ILaunchTemplate launchTemplate;
IVpc vpc;

GameServerGroup.Builder.create(this, "Game server group")
        .gameServerGroupName("sample-gameservergroup-name")
        .instanceDefinitions(List.of(InstanceDefinition.builder()
                .instanceType(InstanceType.of(InstanceClass.C5, InstanceSize.LARGE))
                .build(), InstanceDefinition.builder()
                .instanceType(InstanceType.of(InstanceClass.C4, InstanceSize.LARGE))
                .build()))
        .launchTemplate(launchTemplate)
        .vpc(vpc)
        .build();
```

C# / .NET:

```csharp
ILaunchTemplate launchTemplate;
IVpc vpc;

new GameServerGroup(this, "Game server group", new GameServerGroupProps {
    GameServerGroupName = "sample-gameservergroup-name",
    InstanceDefinitions = new [] { new InstanceDefinition {
        InstanceType = InstanceType.Of(InstanceClass.C5, InstanceSize.LARGE)
    }, new InstanceDefinition {
        InstanceType = InstanceType.Of(InstanceClass.C4, InstanceSize.LARGE)
    } },
    LaunchTemplate = launchTemplate,
    Vpc = vpc
});
```

Golang:

```go
var launchTemplate ILaunchTemplate
var vpc IVpc

gamelift.NewGameServerGroup(this, jsii.String("Game server group"), &GameServerGroupProps{
	GameServerGroupName: jsii.String("sample-gameservergroup-name"),
	InstanceDefinitions: []InstanceDefinition{
		&InstanceDefinition{
			InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_C5, ec2.InstanceSize_LARGE),
		},
		&InstanceDefinition{
			InstanceType: ec2.InstanceType_*Of(ec2.InstanceClass_C4, ec2.InstanceSize_LARGE),
		},
	},
	LaunchTemplate: launchTemplate,
	Vpc: vpc,
})
```

See [Manage game server groups](https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/gsg-integrate-gameservergroup.html)
in the *Amazon GameLift FleetIQ Developer Guide*.

### Scaling Policy

The scaling policy uses the metric `PercentUtilizedGameServers` to maintain a
buffer of idle game servers that can immediately accommodate new games and
players.

TypeScript:

```ts
declare const launchTemplate: ec2.ILaunchTemplate;
declare const vpc: ec2.IVpc;

new gamelift.GameServerGroup(this, 'Game server group', {
  gameServerGroupName: 'sample-gameservergroup-name',
  instanceDefinitions: [{
    instanceType: ec2.InstanceType.of(ec2.InstanceClass.C5, ec2.InstanceSize.LARGE),
  },
  {
    instanceType: ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
  }],
  launchTemplate: launchTemplate,
  vpc: vpc,
  autoScalingPolicy: {
    estimatedInstanceWarmup: Duration.minutes(5),
    targetTrackingConfiguration: 5
  }
});
```

Python:

```python
# launch_template: ec2.ILaunchTemplate
# vpc: ec2.IVpc

gamelift.GameServerGroup(self, "Game server group",
    game_server_group_name="sample-gameservergroup-name",
    instance_definitions=[gamelift.InstanceDefinition(
        instance_type=ec2.InstanceType.of(ec2.InstanceClass.C5, ec2.InstanceSize.LARGE)
    ), gamelift.InstanceDefinition(
        instance_type=ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE)
    )],
    launch_template=launch_template,
    vpc=vpc,
    auto_scaling_policy=gamelift.AutoScalingPolicy(
        estimated_instance_warmup=Duration.minutes(5),
        target_tracking_configuration=5
    )
)
```

Java:

```java
ILaunchTemplate launchTemplate;
IVpc vpc;

GameServerGroup.Builder.create(this, "Game server group")
        .gameServerGroupName("sample-gameservergroup-name")
        .instanceDefinitions(List.of(InstanceDefinition.builder()
                .instanceType(InstanceType.of(InstanceClass.C5, InstanceSize.LARGE))
                .build(), InstanceDefinition.builder()
                .instanceType(InstanceType.of(InstanceClass.C4, InstanceSize.LARGE))
                .build()))
        .launchTemplate(launchTemplate)
        .vpc(vpc)
        .autoScalingPolicy(AutoScalingPolicy.builder()
                .estimatedInstanceWarmup(Duration.minutes(5))
                .targetTrackingConfiguration(5)
                .build())
        .build();
```

C# / .NET:

```csharp
ILaunchTemplate launchTemplate;
IVpc vpc;

new GameServerGroup(this, "Game server group", new GameServerGroupProps {
    GameServerGroupName = "sample-gameservergroup-name",
    InstanceDefinitions = new [] { new InstanceDefinition {
        InstanceType = InstanceType.Of(InstanceClass.C5, InstanceSize.LARGE)
    }, new InstanceDefinition {
        InstanceType = InstanceType.Of(InstanceClass.C4, InstanceSize.LARGE)
    } },
    LaunchTemplate = launchTemplate,
    Vpc = vpc,
    AutoScalingPolicy = new AutoScalingPolicy {
        EstimatedInstanceWarmup = Duration.Minutes(5),
        TargetTrackingConfiguration = 5
    }
});
```

Golang:

```go
var launchTemplate ILaunchTemplate
var vpc IVpc

gamelift.NewGameServerGroup(this, jsii.String("Game server group"), &GameServerGroupProps{
	GameServerGroupName: jsii.String("sample-gameservergroup-name"),
	InstanceDefinitions: []InstanceDefinition{
		&InstanceDefinition{
			InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_C5, ec2.InstanceSize_LARGE),
		},
		&InstanceDefinition{
			InstanceType: ec2.InstanceType_*Of(ec2.InstanceClass_C4, ec2.InstanceSize_LARGE),
		},
	},
	LaunchTemplate: launchTemplate,
	Vpc: vpc,
	AutoScalingPolicy: &AutoScalingPolicy{
		EstimatedInstanceWarmup: awscdk.Duration_Minutes(jsii.Number(5)),
		TargetTrackingConfiguration: jsii.Number(5),
	},
})
```

See [Manage game server groups](https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/gsg-integrate-gameservergroup.html)
in the *Amazon GameLift FleetIQ Developer Guide*.

### Specifying an IAM role for GameLift

The GameLift FleetIQ class automatically creates an IAM role with all the minimum necessary
permissions for GameLift to access your Amazon EC2 Auto Scaling groups. If you wish, you may
specify your own IAM role. It must have the correct permissions, or FleetIQ creation or resource usage may fail.

TypeScript:

```ts
declare const launchTemplate: ec2.ILaunchTemplate;
declare const vpc: ec2.IVpc;

const role = new iam.Role(this, 'Role', {
  assumedBy: new iam.CompositePrincipal(new iam.ServicePrincipal('gamelift.amazonaws.com'),
  new iam.ServicePrincipal('autoscaling.amazonaws.com'))
});
role.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('GameLiftGameServerGroupPolicy'));

new gamelift.GameServerGroup(this, 'Game server group', {
  gameServerGroupName: 'sample-gameservergroup-name',
  instanceDefinitions: [{
    instanceType: ec2.InstanceType.of(ec2.InstanceClass.C5, ec2.InstanceSize.LARGE),
  },
  {
    instanceType: ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
  }],
  launchTemplate: launchTemplate,
  vpc: vpc,
  role: role
});
```

Python:

```python
# launch_template: ec2.ILaunchTemplate
# vpc: ec2.IVpc

role = iam.Role(self, "Role",
    assumed_by=iam.CompositePrincipal(iam.ServicePrincipal("gamelift.amazonaws.com"),
    iam.ServicePrincipal("autoscaling.amazonaws.com"))
)
role.add_managed_policy(iam.ManagedPolicy.from_aws_managed_policy_name("GameLiftGameServerGroupPolicy"))

gamelift.GameServerGroup(self, "Game server group",
    game_server_group_name="sample-gameservergroup-name",
    instance_definitions=[gamelift.InstanceDefinition(
        instance_type=ec2.InstanceType.of(ec2.InstanceClass.C5, ec2.InstanceSize.LARGE)
    ), gamelift.InstanceDefinition(
        instance_type=ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE)
    )],
    launch_template=launch_template,
    vpc=vpc,
    role=role
)
```

Java:

```java
ILaunchTemplate launchTemplate;
IVpc vpc;

Role role = Role.Builder.create(this, "Role")
        .assumedBy(new CompositePrincipal(new ServicePrincipal("gamelift.amazonaws.com"),
        new ServicePrincipal("autoscaling.amazonaws.com")))
        .build();
role.addManagedPolicy(ManagedPolicy.fromAwsManagedPolicyName("GameLiftGameServerGroupPolicy"));

GameServerGroup.Builder.create(this, "Game server group")
        .gameServerGroupName("sample-gameservergroup-name")
        .instanceDefinitions(List.of(InstanceDefinition.builder()
                .instanceType(InstanceType.of(InstanceClass.C5, InstanceSize.LARGE))
                .build(), InstanceDefinition.builder()
                .instanceType(InstanceType.of(InstanceClass.C4, InstanceSize.LARGE))
                .build()))
        .launchTemplate(launchTemplate)
        .vpc(vpc)
        .role(role)
        .build();
```

C# / .NET:

```csharp
ILaunchTemplate launchTemplate;
IVpc vpc;

var role = new Role(this, "Role", new RoleProps {
    AssumedBy = new CompositePrincipal(new ServicePrincipal("gamelift.amazonaws.com"),
    new ServicePrincipal("autoscaling.amazonaws.com"))
});
role.AddManagedPolicy(ManagedPolicy.FromAwsManagedPolicyName("GameLiftGameServerGroupPolicy"));

new GameServerGroup(this, "Game server group", new GameServerGroupProps {
    GameServerGroupName = "sample-gameservergroup-name",
    InstanceDefinitions = new [] { new InstanceDefinition {
        InstanceType = InstanceType.Of(InstanceClass.C5, InstanceSize.LARGE)
    }, new InstanceDefinition {
        InstanceType = InstanceType.Of(InstanceClass.C4, InstanceSize.LARGE)
    } },
    LaunchTemplate = launchTemplate,
    Vpc = vpc,
    Role = role
});
```

Golang:

```go
var launchTemplate ILaunchTemplate
var vpc IVpc

role := iam.NewRole(this, jsii.String("Role"), &RoleProps{
	AssumedBy: iam.NewCompositePrincipal(iam.NewServicePrincipal(jsii.String("gamelift.amazonaws.com")),
	iam.NewServicePrincipal(jsii.String("autoscaling.amazonaws.com"))),
})
role.AddManagedPolicy(iam.ManagedPolicy_FromAwsManagedPolicyName(jsii.String("GameLiftGameServerGroupPolicy")))

gamelift.NewGameServerGroup(this, jsii.String("Game server group"), &GameServerGroupProps{
	GameServerGroupName: jsii.String("sample-gameservergroup-name"),
	InstanceDefinitions: []InstanceDefinition{
		&InstanceDefinition{
			InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_C5, ec2.InstanceSize_LARGE),
		},
		&InstanceDefinition{
			InstanceType: ec2.InstanceType_*Of(ec2.InstanceClass_C4, ec2.InstanceSize_LARGE),
		},
	},
	LaunchTemplate: launchTemplate,
	Vpc: vpc,
	Role: role,
})
```

See [Controlling Access](https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/gsg-iam-permissions-roles.html)
in the *Amazon GameLift FleetIQ Developer Guide*.

### Specifying VPC Subnets

GameLift FleetIQ use by default, all supported GameLift FleetIQ Availability
Zones in your chosen region. You can override this parameter to specify VPCs
subnets that you've set up.

This property cannot be updated after the game server group is created, and the
corresponding Auto Scaling group will always use the property value that is set
with this request, even if the Auto Scaling group is updated directly.

TypeScript:

```ts
declare const launchTemplate: ec2.ILaunchTemplate;
declare const vpc: ec2.IVpc;

new gamelift.GameServerGroup(this, 'GameServerGroup', {
  gameServerGroupName: 'sample-gameservergroup-name',
  instanceDefinitions: [{
    instanceType: ec2.InstanceType.of(ec2.InstanceClass.C5, ec2.InstanceSize.LARGE),
  },
  {
    instanceType: ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
  }],
  launchTemplate: launchTemplate,
  vpc: vpc,
  vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }
});
```

Python:

```python
# launch_template: ec2.ILaunchTemplate
# vpc: ec2.IVpc

gamelift.GameServerGroup(self, "GameServerGroup",
    game_server_group_name="sample-gameservergroup-name",
    instance_definitions=[gamelift.InstanceDefinition(
        instance_type=ec2.InstanceType.of(ec2.InstanceClass.C5, ec2.InstanceSize.LARGE)
    ), gamelift.InstanceDefinition(
        instance_type=ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE)
    )],
    launch_template=launch_template,
    vpc=vpc,
    vpc_subnets=ec2.SubnetSelection(subnet_type=ec2.SubnetType.PUBLIC)
)
```

Java:

```java
ILaunchTemplate launchTemplate;
IVpc vpc;

GameServerGroup.Builder.create(this, "GameServerGroup")
        .gameServerGroupName("sample-gameservergroup-name")
        .instanceDefinitions(List.of(InstanceDefinition.builder()
                .instanceType(InstanceType.of(InstanceClass.C5, InstanceSize.LARGE))
                .build(), InstanceDefinition.builder()
                .instanceType(InstanceType.of(InstanceClass.C4, InstanceSize.LARGE))
                .build()))
        .launchTemplate(launchTemplate)
        .vpc(vpc)
        .vpcSubnets(SubnetSelection.builder().subnetType(SubnetType.PUBLIC).build())
        .build();
```

C# / .NET:

```csharp
ILaunchTemplate launchTemplate;
IVpc vpc;

new GameServerGroup(this, "GameServerGroup", new GameServerGroupProps {
    GameServerGroupName = "sample-gameservergroup-name",
    InstanceDefinitions = new [] { new InstanceDefinition {
        InstanceType = InstanceType.Of(InstanceClass.C5, InstanceSize.LARGE)
    }, new InstanceDefinition {
        InstanceType = InstanceType.Of(InstanceClass.C4, InstanceSize.LARGE)
    } },
    LaunchTemplate = launchTemplate,
    Vpc = vpc,
    VpcSubnets = new SubnetSelection { SubnetType = SubnetType.PUBLIC }
});
```

Golang:

```go
var launchTemplate ILaunchTemplate
var vpc IVpc

gamelift.NewGameServerGroup(this, jsii.String("GameServerGroup"), &GameServerGroupProps{
	GameServerGroupName: jsii.String("sample-gameservergroup-name"),
	InstanceDefinitions: []InstanceDefinition{
		&InstanceDefinition{
			InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_C5, ec2.InstanceSize_LARGE),
		},
		&InstanceDefinition{
			InstanceType: ec2.InstanceType_*Of(ec2.InstanceClass_C4, ec2.InstanceSize_LARGE),
		},
	},
	LaunchTemplate: launchTemplate,
	Vpc: vpc,
	VpcSubnets: &SubnetSelection{
		SubnetType: ec2.SubnetType_PUBLIC,
	},
})
```

### FleetIQ Monitoring

GameLift FleetIQ sends metrics to CloudWatch so that you can collect and
analyze the activity of your Game server fleet, including the number of
utilized game servers, and the number of game server interruption due to
limited Spot availability.

You can then use CloudWatch alarms to alert you, for example, when the portion
of game servers that are currently supporting game executions exceed a certain
threshold which could means that your autoscaling policy need to be adjust to
add more instances to match with player demand.

CDK provides a generic `metric` method that can be used
to produce metric configurations for any metric provided by GameLift FleetIQ;
the configurations are pre-populated with the correct dimensions for the
matchmaking configuration.

TypeScript:

```ts
declare const gameServerGroup: gamelift.IGameServerGroup;
// Alarm that triggers when the percent of utilized game servers exceed 90%
new cloudwatch.Alarm(this, 'Alarm', {
  metric: gameServerGroup.metric('UtilizedGameServers'),
  threshold: 0.9,
  evaluationPeriods: 2,
});
```

Python:

```python
# game_server_group: gamelift.IGameServerGroup

# Alarm that triggers when the percent of utilized game servers exceed 90%
cloudwatch.Alarm(self, "Alarm",
    metric=game_server_group.metric("UtilizedGameServers"),
    threshold=0.9,
    evaluation_periods=2
)
```

Java:

```java
IGameServerGroup gameServerGroup;

// Alarm that triggers when the percent of utilized game servers exceed 90%
// Alarm that triggers when the percent of utilized game servers exceed 90%
Alarm.Builder.create(this, "Alarm")
        .metric(gameServerGroup.metric("UtilizedGameServers"))
        .threshold(0.9)
        .evaluationPeriods(2)
        .build();
```

C# / .NET:

```csharp
IGameServerGroup gameServerGroup;

// Alarm that triggers when the percent of utilized game servers exceed 90%
// Alarm that triggers when the percent of utilized game servers exceed 90%
new Alarm(this, "Alarm", new AlarmProps {
    Metric = gameServerGroup.Metric("UtilizedGameServers"),
    Threshold = 0.9,
    EvaluationPeriods = 2
});
```

Golang:

```go
var gameServerGroup IGameServerGroup

// Alarm that triggers when the percent of utilized game servers exceed 90%
// Alarm that triggers when the percent of utilized game servers exceed 90%
cloudwatch.NewAlarm(this, jsii.String("Alarm"), &AlarmProps{
	Metric: gameServerGroup.Metric(jsii.String("UtilizedGameServers")),
	Threshold: jsii.Number(0.9),
	EvaluationPeriods: jsii.Number(2),
})
```

See: [Monitoring with CloudWatch](https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/gsg-metrics.html)
in the *Amazon GameLift FleetIQ Developer Guide*.

## Types

### Constructs (L2)

- [`Alias`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.Alias.html) Construct (L2) A Amazon GameLift alias is used to abstract a fleet designation.
- [`AliasBase`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.AliasBase.html) Construct (L2) Base class for new and imported GameLift Alias.
- [`Build`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.Build.html) Construct (L2) A GameLift build, that is installed and runs on instances in an Amazon GameLift fleet.
- [`BuildBase`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.BuildBase.html) Construct (L2) Base class for new and imported GameLift server build.
- [`BuildFleet`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.BuildFleet.html) Construct (L2) A fleet contains Amazon Elastic Compute Cloud (Amazon EC2) instances that GameLift hosts.
- [`FleetBase`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.FleetBase.html) Construct (L2) Base class for new and imported GameLift fleet.
- [`GameServerGroup`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.GameServerGroup.html) Construct (L2) Creates a GameLift FleetIQ game server group for managing game hosting on a collection of Amazon EC2 instances for game hosting.
- [`GameServerGroupBase`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.GameServerGroupBase.html) Construct (L2) Base class for new and imported GameLift FleetIQ game server group.
- [`GameSessionQueue`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.GameSessionQueue.html) Construct (L2) The GameSessionQueue resource creates a placement queue that processes requests for new game sessions.
- [`GameSessionQueueBase`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.GameSessionQueueBase.html) Construct (L2) Base class for new and imported GameLift GameSessionQueue.
- [`MatchmakingConfigurationBase`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.MatchmakingConfigurationBase.html) Construct (L2) Base class for new and imported GameLift Matchmaking configuration.
- [`MatchmakingRuleSet`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.MatchmakingRuleSet.html) Construct (L2) Creates a new rule set for FlexMatch matchmaking.
- [`MatchmakingRuleSetBase`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.MatchmakingRuleSetBase.html) Construct (L2) Base class for new and imported GameLift matchmaking ruleSet.
- [`QueuedMatchmakingConfiguration`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.QueuedMatchmakingConfiguration.html) Construct (L2) A FlexMatch matchmaker process does the work of building a game match.
- [`Script`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.Script.html) Construct (L2) A GameLift script, that is installed and runs on instances in an Amazon GameLift fleet.
- [`ScriptBase`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.ScriptBase.html) Construct (L2) Base class for new and imported GameLift realtime server script.
- [`StandaloneMatchmakingConfiguration`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.StandaloneMatchmakingConfiguration.html) Construct (L2) A FlexMatch matchmaker process does the work of building a game match.

### Structs

- [`AliasAttributes`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.AliasAttributes.html) Struct A full specification of an alias that can be used to import it fluently into the CDK application.
- [`AliasOptions`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.AliasOptions.html) Struct Options for `gamelift.Alias`.
- [`AliasProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.AliasProps.html) Struct Properties for a new Fleet alias.
- [`AutoScalingPolicy`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.AutoScalingPolicy.html) Struct Configuration settings for intelligent automatic scaling that uses target tracking.
- [`BuildAttributes`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.BuildAttributes.html) Struct Represents a Build content defined outside of this stack.
- [`BuildFleetProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.BuildFleetProps.html) Struct Properties for a new Gamelift build fleet.
- [`BuildProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.BuildProps.html) Struct Properties for a new build.
- [`ContentConfig`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.ContentConfig.html) Struct Result of binding `Content` into a `Build`.
- [`FleetAttributes`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.FleetAttributes.html) Struct A full specification of a fleet that can be used to import it fluently into the CDK application.
- [`FleetProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.FleetProps.html) Struct Properties for a new Gamelift fleet.
- [`GameProperty`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.GameProperty.html) Struct A set of custom properties for a game session, formatted as key-value pairs.
- [`GameServerGroupAttributes`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.GameServerGroupAttributes.html) Struct Represents a GameServerGroup content defined outside of this stack.
- [`GameServerGroupProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.GameServerGroupProps.html) Struct Properties for a new Gamelift FleetIQ Game server group.
- [`GameSessionQueueAttributes`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.GameSessionQueueAttributes.html) Struct A full specification of an gameSessionQueue that can be used to import it fluently into the CDK application.
- [`GameSessionQueueProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.GameSessionQueueProps.html) Struct Properties for a new Fleet gameSessionQueue.
- [`IngressRule`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.IngressRule.html) Struct A range of IP addresses and port settings that allow inbound traffic to connect to server processes on an instance in a fleet.
- [`InstanceDefinition`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.InstanceDefinition.html) Struct An allowed instance type for a game server group.
- [`Location`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.Location.html) Struct A remote location where a multi-location fleet can deploy EC2 instances for game hosting.
- [`LocationCapacity`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.LocationCapacity.html) Struct Current resource capacity settings in a specified fleet or location.
- [`MatchmakingConfigurationAttributes`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.MatchmakingConfigurationAttributes.html) Struct A full specification of a matchmaking configuration that can be used to import it fluently into the CDK application.
- [`MatchmakingConfigurationProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.MatchmakingConfigurationProps.html) Struct Properties for a new Gamelift matchmaking configuration.
- [`MatchmakingRuleSetAttributes`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.MatchmakingRuleSetAttributes.html) Struct A full specification of a matchmaking ruleSet that can be used to import it fluently into the CDK application.
- [`MatchmakingRuleSetProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.MatchmakingRuleSetProps.html) Struct Properties for a new matchmaking ruleSet.
- [`PlayerLatencyPolicy`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.PlayerLatencyPolicy.html) Struct The queue setting that determines the highest latency allowed for individual players when placing a game session.
- [`PortProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.PortProps.html) Struct Properties to create a port range.
- [`PriorityConfiguration`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.PriorityConfiguration.html) Struct Custom prioritization settings for use by a game session queue when placing new game sessions with available game servers.
- [`QueuedMatchmakingConfigurationProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.QueuedMatchmakingConfigurationProps.html) Struct Properties for a new queued matchmaking configuration.
- [`ResourceCreationLimitPolicy`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.ResourceCreationLimitPolicy.html) Struct A policy that limits the number of game sessions a player can create on the same fleet.
- [`RuleSetBodyConfig`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.RuleSetBodyConfig.html) Struct Interface to represent output result of a RuleSetContent binding.
- [`RuleSetContentProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.RuleSetContentProps.html) Struct Properties for a new matchmaking ruleSet content.
- [`RuntimeConfiguration`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.RuntimeConfiguration.html) Struct A collection of server process configurations that describe the set of processes to run on each instance in a fleet.
- [`ScriptAttributes`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.ScriptAttributes.html) Struct Represents a Script content defined outside of this stack.
- [`ScriptProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.ScriptProps.html) Struct Properties for a new realtime server script.
- [`ServerProcess`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.ServerProcess.html) Struct Configuration of a fleet server process.
- [`StandaloneMatchmakingConfigurationProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.StandaloneMatchmakingConfigurationProps.html) Struct Properties for a new standalone matchmaking configuration.

### Classes

- [`AssetContent`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.AssetContent.html) Class Game content from a local directory.
- [`Content`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.Content.html) Class Before deploying your GameLift-enabled multiplayer game servers for hosting with the GameLift service, you need to upload your game server files.
- [`Peer`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.Peer.html) Class Peer object factories.
- [`Port`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.Port.html) Class Interface for classes that provide the connection-specification parts of a security group rule.
- [`RuleSetContent`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.RuleSetContent.html) Class The rule set determines the two key elements of a match: your game's team structure and size, and how to group players together for the best possible match.
- [`S3Content`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.S3Content.html) Class Game content from an S3 archive.

### Enums

- [`BalancingStrategy`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.BalancingStrategy.html) Enum Indicates how GameLift FleetIQ balances the use of Spot Instances and On-Demand Instances in the game server group.
- [`DeleteOption`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.DeleteOption.html) Enum The type of delete to perform.
- [`OperatingSystem`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.OperatingSystem.html) Enum The operating system that the game server binaries are built to run on.
- [`PriorityType`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.PriorityType.html) Enum Priority to condider when placing new game sessions.
- [`Protocol`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.Protocol.html) Enum Protocol for use in Connection Rules.

### Interfaces

- [`IAlias`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.IAlias.html) Interface Represents a Gamelift Alias for a Gamelift fleet destination.
- [`IBuild`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.IBuild.html) Interface Your custom-built game server software that runs on GameLift and hosts game sessions for your players.
- [`IBuildFleet`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.IBuildFleet.html) Interface Represents a GameLift Fleet used to run a custom game build.
- [`IFleet`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.IFleet.html) Interface Represents a Gamelift fleet.
- [`IGameServerGroup`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.IGameServerGroup.html) Interface Represent a GameLift FleetIQ game server group.
- [`IGameSessionQueue`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.IGameSessionQueue.html) Interface Represents a Gamelift GameSessionQueue for a Gamelift fleet destination.
- [`IGameSessionQueueDestination`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.IGameSessionQueueDestination.html) Interface Represents a game session queue destination.
- [`IMatchmakingConfiguration`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.IMatchmakingConfiguration.html) Interface Represents a Gamelift matchmaking configuration.
- [`IMatchmakingRuleSet`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.IMatchmakingRuleSet.html) Interface Represents a Gamelift matchmaking ruleset.
- [`IPeer`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.IPeer.html) Interface Interface for classes that provide the peer-specification parts of an inbound permission.
- [`IRuleSetBody`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.IRuleSetBody.html) Interface Interface to represent Matchmaking RuleSet schema.
- [`IRuleSetContent`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.IRuleSetContent.html) Interface Interface to represent a Matchmaking RuleSet content.
- [`IScript`](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-gamelift-alpha.IScript.html) Interface Your configuration and custom game logic for use with Realtime Servers.
