Menu
AWS CloudFormation
User Guide (API Version 2010-05-15)

AWS::GameLift::Fleet

The AWS::GameLift::Fleet resource creates an Amazon GameLift (GameLift) fleet to host game servers. A fleet is a set of EC2 instances, each of which is a host in the fleet. For more information, see the CreateFleet action in the Amazon GameLift API Reference.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

Copy
{ "Type" : "AWS::GameLift::Fleet", "Properties" : { "BuildId" : String, "Description" : String, "DesiredEC2Instances" : Integer, "EC2InboundPermissions" : [ EC2InboundPermission, ... ], "EC2InstanceType" : String, "LogPaths" : [ String, ... ], "MaxSize" : Integer, "MinSize" : Integer, "Name" : String, "ServerLaunchParameters" : String, "ServerLaunchPath" : String } }

YAML

Copy
Type: "AWS::GameLift::Fleet" Properties: BuildId: String Description: String DesiredEC2Instances: Integer EC2InboundPermissions: - EC2InboundPermission EC2InstanceType: String LogPaths: [ String, ... ] MaxSize: Integer MinSize: Integer Name: String ServerLaunchParameters: String ServerLaunchPath: String

Properties

BuildId

The unique identifier for the build that you want to use with this fleet.

Required: Yes

Type: String

Update requires: Replacement

Description

Information that helps you identify the purpose of this fleet.

Required: No

Type: String

Update requires: No interruption

DesiredEC2Instances

The number of EC2 instances that you want in this fleet.

Required: Yes

Type: Integer

Update requires: No interruption

EC2InboundPermissions

The incoming traffic, expressed as IP ranges and port numbers, that is permitted to access the game server. If you don't specify values, no traffic is permitted to your game servers.

Required: No

Type: List of Amazon GameLift Fleet EC2InboundPermission

Update requires: No interruption

EC2InstanceType

The type of EC2 instances that the fleet uses. EC2 instance types define the CPU, memory, storage, and networking capacity of the fleet's hosts. For more information about the instance types that are supported by GameLift, see the EC2InstanceType parameter in the Amazon GameLift API Reference.

Required: Yes

Type: String

Update requires: Replacement

LogPaths

The path to game-session log files that are generated by your game server, with the slashes (\) escaped. After a game session has been terminated, GameLift captures and stores the logs in an S3 bucket.

Required: No

Type: List of String values

Update requires: Replacement

MaxSize

The maximum number of EC2 instances that you want to allow in this fleet. By default, AWS CloudFormation, sets this property to 1.

Required: No

Type: Integer

Update requires: No interruption

MinSize

The minimum number of EC2 instances that you want to allow in this fleet. By default, AWS CloudFormation, sets this property to 0.

Required: No

Type: Integer

Update requires: No interruption

Name

An identifier to associate with this fleet. Fleet names don't need to be unique.

Required: Yes

Type: String

Update requires: No interruption

ServerLaunchParameters

The parameters that are required to launch your game server. Specify these parameters as a string of command-line parameters, such as +sv_port 33435 +start_lobby.

Required: No

Type: String

Update requires: Replacement

ServerLaunchPath

The location of your game server that GameLift launches. You must escape the slashes (\) and use the following pattern: C:\\game\\launchpath. For example, if your game server files are in the MyGame folder, the path should be C:\\game\\MyGame\\server.exe.

Required: Yes

Type: String

Update requires: Replacement

Return Value

Ref

When the logical ID of this resource is provided to the Ref intrinsic function, Ref returns the fleet ID, such as myfleet-a01234b56-7890-1de2-f345-g67h8i901j2k.

For more information about using the Ref function, see Ref.

Example

The following example creates a GameLift fleet named MyGameFleet with two inbound permissions. The fleet uses a Ref intrinsic function to specify a build, which can be declared elsewhere in the same template. For the log path and server launch path, the example uses the escape character (\) to escape the slashes (\).

JSON

Copy
"FleetResource": { "Type": "AWS::GameLift::Fleet", "Properties": { "Name": "MyGameFleet", "Description": "A fleet for my game", "BuildId": { "Ref": "BuildResource" }, "ServerLaunchPath": "c:\\game\\TestApplicationServer.exe", "LogPaths": [ "c:\\game\\testlog.log", "c:\\game\\testlog2.log" ], "EC2InstanceType": "t2.small", "DesiredEC2Instances": "2", "EC2InboundPermissions": [ { "FromPort": "1234", "ToPort": "1324", "IpRange": "0.0.0.0/24", "Protocol": "TCP" }, { "FromPort": "1356", "ToPort": "1578", "IpRange": "192.168.0.0/24", "Protocol": "UDP" } ] } }

YAML

Copy
FleetResource: Type: "AWS::GameLift::Fleet" Properties: Name: "MyGameFleet" Description: "A fleet for my game" BuildId: Ref: "BuildResource" ServerLaunchPath: "c:\\game\\TestApplicationServer.exe" LogPaths: - "c:\\game\\testlog.log" - "c:\\game\\testlog2.log" EC2InstanceType: "t2.small" DesiredEC2Instances: "2" EC2InboundPermissions: - FromPort: "1234" ToPort: "1324" IpRange: "0.0.0.0/24" Protocol: "TCP" - FromPort: "1356" ToPort: "1578" IpRange: "192.168.0.0/24" Protocol: "UDP"