AWS::GameLift::Fleet - AWS CloudFormation

AWS::GameLift::Fleet

The AWS::GameLift::Fleet resource creates an Amazon GameLift (GameLift) fleet to host custom game server or Realtime Servers. A fleet is a set of EC2 instances, configured with instructions to run game servers on each instance.

Syntax

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

JSON

{ "Type" : "AWS::GameLift::Fleet", "Properties" : { "AnywhereConfiguration" : AnywhereConfiguration, "ApplyCapacity" : String, "BuildId" : String, "CertificateConfiguration" : CertificateConfiguration, "ComputeType" : String, "Description" : String, "DesiredEC2Instances" : Integer, "EC2InboundPermissions" : [ IpPermission, ... ], "EC2InstanceType" : String, "FleetType" : String, "InstanceRoleARN" : String, "InstanceRoleCredentialsProvider" : String, "Locations" : [ LocationConfiguration, ... ], "MaxSize" : Integer, "MetricGroups" : [ String, ... ], "MinSize" : Integer, "Name" : String, "NewGameSessionProtectionPolicy" : String, "PeerVpcAwsAccountId" : String, "PeerVpcId" : String, "ResourceCreationLimitPolicy" : ResourceCreationLimitPolicy, "RuntimeConfiguration" : RuntimeConfiguration, "ScalingPolicies" : [ ScalingPolicy, ... ], "ScriptId" : String } }

Properties

AnywhereConfiguration

Amazon GameLift Anywhere configuration options.

Required: No

Type: AnywhereConfiguration

Update requires: No interruption

ApplyCapacity

Current resource capacity settings for managed EC2 fleets and managed container fleets. For multi-location fleets, location values might refer to a fleet's remote location or its home Region.

Returned by: DescribeFleetCapacity, DescribeFleetLocationCapacity, UpdateFleetCapacity

Required: No

Type: String

Allowed values: ON_UPDATE | ON_CREATE_AND_UPDATE

Update requires: Replacement

BuildId

A unique identifier for a build to be deployed on the new fleet. If you are deploying the fleet with a custom game build, you must specify this property. The build must have been successfully uploaded to Amazon GameLift and be in a READY status. This fleet setting cannot be changed once the fleet is created.

Required: Conditional

Type: String

Pattern: ^build-\S+|^arn:.*:build/build-\S+

Update requires: Replacement

CertificateConfiguration

Prompts Amazon GameLift to generate a TLS/SSL certificate for the fleet. Amazon GameLift uses the certificates to encrypt traffic between game clients and the game servers running on Amazon GameLift. By default, the CertificateConfiguration is DISABLED. You can't change this property after you create the fleet.

AWS Certificate Manager (ACM) certificates expire after 13 months. Certificate expiration can cause fleets to fail, preventing players from connecting to instances in the fleet. We recommend you replace fleets before 13 months, consider using fleet aliases for a smooth transition.

Note

ACM isn't available in all AWS regions. A fleet creation request with certificate generation enabled in an unsupported Region, fails with a 4xx error. For more information about the supported Regions, see Supported Regions in the AWS Certificate Manager User Guide.

Required: No

Type: CertificateConfiguration

Update requires: Replacement

ComputeType

The type of compute resource used to host your game servers.

  • EC2 – The game server build is deployed to Amazon EC2 instances for cloud hosting. This is the default setting.

  • ANYWHERE – Game servers and supporting software are deployed to compute resources that you provide and manage. With this compute type, you can also set the AnywhereConfiguration parameter.

Required: No

Type: String

Allowed values: EC2 | ANYWHERE

Update requires: Replacement

Description

A description for the fleet.

Required: No

Type: String

Minimum: 1

Maximum: 1024

Update requires: No interruption

DesiredEC2Instances

The number of EC2 instances that you want this fleet to host. When creating a new fleet, GameLift automatically sets this value to "1" and initiates a single instance. Once the fleet is active, update this value to trigger GameLift to add or remove instances from the fleet.

Required: No

Type: Integer

Minimum: 0

Update requires: No interruption

EC2InboundPermissions

The IP address ranges and port settings that allow inbound traffic to access game server processes and other processes on this fleet. Set this parameter for managed EC2 fleets. You can leave this parameter empty when creating the fleet, but you must call https://docs.aws.amazon.com/gamelift/latest/apireference/API_UpdateFleetPortSettings to set it before players can connect to game sessions. As a best practice, we recommend opening ports for remote access only when you need them and closing them when you're finished. For Realtime Servers fleets, Amazon GameLift automatically sets TCP and UDP ranges.

Required: No

Type: Array of IpPermission

Maximum: 50

Update requires: No interruption

EC2InstanceType

The Amazon GameLift-supported Amazon EC2 instance type to use with managed EC2 fleets. Instance type determines the computing resources that will be used to host your game servers, including CPU, memory, storage, and networking capacity. See Amazon Elastic Compute Cloud Instance Types for detailed descriptions of Amazon EC2 instance types.

Required: No

Type: String

Pattern: ^.*..*$

Update requires: Replacement

FleetType

Indicates whether to use On-Demand or Spot instances for this fleet. By default, this property is set to ON_DEMAND. Learn more about when to use On-Demand versus Spot Instances. This fleet property can't be changed after the fleet is created.

Required: No

Type: String

Allowed values: ON_DEMAND | SPOT

Update requires: Replacement

InstanceRoleARN

A unique identifier for an IAM role that manages access to your AWS services. With an instance role ARN set, any application that runs on an instance in this fleet can assume the role, including install scripts, server processes, and daemons (background processes). Create a role or look up a role's ARN by using the IAM dashboard in the AWS Management Console. Learn more about using on-box credentials for your game servers at Access external resources from a game server. This attribute is used with fleets where ComputeType is EC2.

Required: No

Type: String

Pattern: ^arn:aws(-.*)?:[a-z-]+:(([a-z]+-)+[0-9])?:([0-9]{12})?:[^.]+$

Minimum: 1

Update requires: Replacement

InstanceRoleCredentialsProvider

Indicates that fleet instances maintain a shared credentials file for the IAM role defined in InstanceRoleArn. Shared credentials allow applications that are deployed with the game server executable to communicate with other AWS resources. This property is used only when the game server is integrated with the server SDK version 5.x. For more information about using shared credentials, see Communicate with other AWS resources from your fleets. This attribute is used with fleets where ComputeType is EC2.

Required: No

Type: String

Allowed values: SHARED_CREDENTIAL_FILE

Update requires: Replacement

Locations

A set of remote locations to deploy additional instances to and manage as a multi-location fleet. Use this parameter when creating a fleet in AWS Regions that support multiple locations. You can add any AWS Region or Local Zone that's supported by Amazon GameLift. Provide a list of one or more AWS Region codes, such as us-west-2, or Local Zone names. When using this parameter, Amazon GameLift requires you to include your home location in the request. For a list of supported Regions and Local Zones, see Amazon GameLift service locations for managed hosting.

Required: No

Type: Array of LocationConfiguration

Minimum: 1

Maximum: 100

Update requires: No interruption

MaxSize

The maximum number of instances that are allowed in the specified fleet location. If this parameter is not set, the default is 1.

Required: No

Type: Integer

Minimum: 0

Update requires: No interruption

MetricGroups

The name of an AWS CloudWatch metric group to add this fleet to. A metric group is used to aggregate the metrics for multiple fleets. You can specify an existing metric group name or set a new name to create a new metric group. A fleet can be included in only one metric group at a time.

Required: No

Type: Array of String

Maximum: 1

Update requires: No interruption

MinSize

The minimum number of instances that are allowed in the specified fleet location. If this parameter is not set, the default is 0.

Required: No

Type: Integer

Minimum: 0

Update requires: No interruption

Name

A descriptive label that is associated with a fleet. Fleet names do not need to be unique.

Required: Yes

Type: String

Minimum: 1

Maximum: 1024

Update requires: No interruption

NewGameSessionProtectionPolicy

The status of termination protection for active game sessions on the fleet. By default, this property is set to NoProtection.

  • NoProtection - Game sessions can be terminated during active gameplay as a result of a scale-down event.

  • FullProtection - Game sessions in ACTIVE status cannot be terminated during a scale-down event.

Required: No

Type: String

Allowed values: FullProtection | NoProtection

Update requires: No interruption

PeerVpcAwsAccountId

Used when peering your Amazon GameLift fleet with a VPC, the unique identifier for the AWS account that owns the VPC. You can find your account ID in the AWS Management Console under account settings.

Required: No

Type: String

Pattern: ^[0-9]{12}$

Minimum: 1

Maximum: 1024

Update requires: Replacement

PeerVpcId

A unique identifier for a VPC with resources to be accessed by your Amazon GameLift fleet. The VPC must be in the same Region as your fleet. To look up a VPC ID, use the VPC Dashboard in the AWS Management Console. Learn more about VPC peering in VPC Peering with Amazon GameLift Fleets.

Required: No

Type: String

Pattern: ^vpc-\S+

Minimum: 1

Maximum: 1024

Update requires: Replacement

ResourceCreationLimitPolicy

A policy that limits the number of game sessions that an individual player can create on instances in this fleet within a specified span of time.

Required: No

Type: ResourceCreationLimitPolicy

Update requires: No interruption

RuntimeConfiguration

Instructions for how to launch and maintain server processes on instances in the fleet. The runtime configuration defines one or more server process configurations, each identifying a build executable or Realtime script file and the number of processes of that type to run concurrently.

Note

The RuntimeConfiguration parameter is required unless the fleet is being configured using the older parameters ServerLaunchPath and ServerLaunchParameters, which are still supported for backward compatibility.

Required: Conditional

Type: RuntimeConfiguration

Update requires: No interruption

ScalingPolicies

Rule that controls how a fleet is scaled. Scaling policies are uniquely identified by the combination of name and fleet ID.

Required: No

Type: Array of ScalingPolicy

Maximum: 50

Update requires: No interruption

ScriptId

The unique identifier for a Realtime configuration script to be deployed on fleet instances. You can use either the script ID or ARN. Scripts must be uploaded to Amazon GameLift prior to creating the fleet. This fleet property cannot be changed later.

Note

You can't use the !Ref command to reference a script created with a CloudFormation template for the fleet property ScriptId. Instead, use Fn::GetAtt Script.Arn or Fn::GetAtt Script.Id to retrieve either of these properties as input for ScriptId. Alternatively, enter a ScriptId string manually.

Required: Conditional

Type: String

Pattern: ^script-\S+|^arn:.*:script/script-\S+

Update requires: Replacement

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the fleet ID, such as fleet-1111aaaa-22bb-33cc-44dd-5555eeee66ff.

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

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the Fn::GetAtt intrinsic function, see Fn::GetAtt.

FleetId

A unique identifier for the fleet.

Examples

Create GameLift fleet with a Build

The following example creates and configures a GameLift fleet for a custom game build. The fleet uses a Ref intrinsic function to specify a build, which can be declared elsewhere in the same template. The example syntax for log path and server launch path uses values for a Windows build.

Note: the JSON example shows how to escape the slashes (\\).

JSON

{ "Resources": { "FleetResource": { "Type": "AWS::GameLift::Fleet", "Properties": { "BuildId": { "Ref": "BuildResource" }, "CertificateConfiguration": { "CertificateType": "DISABLED" }, "Description": "Description of my Fleet", "DesiredEC2Instances": 1, "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" } ], "EC2InstanceType": "c4.large", "FleetType": "SPOT", "LogPaths": [ "c:\\game\\testlog.log", "c:\\game\\testlog2.log" ], "MetricGroups": [ "MetricGroupName" ], "Name": "MyGameFleet", "NewGameSessionProtectionPolicy": "FullProtection", "ResourceCreationLimitPolicy": { "NewGameSessionsPerCreator": 5, "PolicyPeriodInMinutes": 2 }, "RuntimeConfiguration": { "GameSessionActivationTimeoutSeconds": 300, "MaxConcurrentGameSessionActivations": 1, "ServerProcesses": [ { "ConcurrentExecutions": 1, "LaunchPath": "c:\\game\\TestApplicationServer.exe" } ] }, "Locations": [ "us-west-2", "us-east-1", "eu-west-1" ] } } } }

YAML

Resources: FleetResource: Type: AWS::GameLift::Fleet Properties: BuildId: !Ref BuildResource CertificateConfiguration: CertificateType: DISABLED Description: Description of my Game Fleet DesiredEC2Instances: 1 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 EC2InstanceType: c4.large FleetType: SPOT LogPaths: - c:\game\testlog.log - c:\game\testlog2.log MetricGroups: - MetricGroupName Name: MyGameFleet NewGameSessionProtectionPolicy: FullProtection ResourceCreationLimitPolicy: NewGameSessionsPerCreator: 5 PolicyPeriodInMinutes: 2 RuntimeConfiguration: GameSessionActivationTimeoutSeconds: 300 MaxConcurrentGameSessionActivations: 1 ServerProcesses: - ConcurrentExecutions: 1 LaunchPath: c:\game\TestApplicationServer.exe Locations: - Location: 'us-west-2' - Location: 'us-east-1' - Location: 'eu-west-1'

Create GameLift fleet with a Script

The following example creates and configures a GameLift fleet to run Realtime Servers. The fleet uses a GetAtt intrinsic function to specify a script, which can be declared elsewhere in the same template. Note that the syntax example for the log path and server launch path are for Linux, as all Realtime Servers are deployed with Linux.

JSON

{ "Resources": { "FleetResource": { "Type": "AWS::GameLift::Fleet", "Properties": { "CertificateConfiguration": { "CertificateType": "DISABLED" }, "Description": "Description of my Game Fleet", "DesiredEC2Instances": 1, "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" } ], "EC2InstanceType": "c4.large", "FleetType": "SPOT", "LogPaths": [ "/local/game/testlog.log", "/local/game/testlog2.log" ], "MetricGroups": [ "MetricGroupName" ], "Name": "MyGameFleet", "NewGameSessionProtectionPolicy": "FullProtection", "ResourceCreationLimitPolicy": { "NewGameSessionsPerCreator": 5, "PolicyPeriodInMinutes": 2 }, "RuntimeConfiguration": { "GameSessionActivationTimeoutSeconds": 300, "MaxConcurrentGameSessionActivations": 1, "ServerProcesses": [ { "ConcurrentExecutions": 1, "LaunchPath": "/local/game/myscript.js" } ] }, "ScriptId": { "Fn::GetAtt": [ "ScriptResource", "Id" ] }, "Locations": [ "us-west-2", "us-east-1", "eu-west-1" ] } } } }

YAML

Resources: FleetResource: Type: AWS::GameLift::Fleet Properties: CertificateConfiguration: CertificateType: DISABLED Description: Description of my game fleet DesiredEC2Instances: 1 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 EC2InstanceType: c4.large FleetType: SPOT LogPaths: - '/local/game/testlog.log' - '/local/game/testlog2.log' MetricGroups: - MetricGroupName Name: MyGameFleet NewGameSessionProtectionPolicy: FullProtection ResourceCreationLimitPolicy: NewGameSessionsPerCreator: 5 PolicyPeriodInMinutes: 2 RuntimeConfiguration: GameSessionActivationTimeoutSeconds: 300 MaxConcurrentGameSessionActivations: 1 ServerProcesses: - ConcurrentExecutions: 1 LaunchPath: '/local/game/myscript.js' ScriptId: !GetAtt ScriptResource.Id Locations: - Location: 'us-west-2' - Location: 'us-east-1' - Location: 'eu-west-1'

See also