CreateFleet - GameLift Service

CreateFleet

Creates a fleet of Amazon Elastic Compute Cloud (Amazon Elastic Compute Cloud) instances to host your custom game server or Realtime Servers. Use this operation to configure the computing resources for your fleet and provide instructions for running game servers on each instance.

Most GameLift fleets can deploy instances to multiple locations, including the home Region (where the fleet is created) and an optional set of remote locations. Fleets that are created in the following AWS Regions support multiple locations: us-east-1 (N. Virginia), us-west-2 (Oregon), eu-central-1 (Frankfurt), eu-west-1 (Ireland), ap-southeast-2 (Sydney), ap-northeast-1 (Tokyo), and ap-northeast-2 (Seoul). Fleets that are created in other GameLift Regions can deploy instances in the fleet's home Region only. All fleet instances use the same configuration regardless of location; however, you can adjust capacity settings and turn auto-scaling on/off for each location.

To create a fleet, choose the hardware for your instances, specify a game server build or Realtime script to deploy, and provide a runtime configuration to direct GameLift how to start and run game servers on each instance in the fleet. Set permissions for inbound traffic to your game servers, and enable optional features as needed. When creating a multi-location fleet, provide a list of additional remote locations.

If you need to debug your fleet, fetch logs, view performance metrics or other actions on the fleet, create the development fleet with port 22/3389 open. As a best practice, we recommend opening ports for remote access only when you need them and closing them when you're finished.

If successful, this operation creates a new Fleet resource and places it in NEW status, which prompts GameLift to initiate the fleet creation workflow. You can track fleet creation by checking fleet status using DescribeFleetAttributes and DescribeFleetLocationAttributes /, or by monitoring fleet creation events using DescribeFleetEvents . As soon as the fleet status changes to ACTIVE, you can enable automatic scaling for the fleet with PutScalingPolicy and set capacity for the home Region with UpdateFleetCapacity . When the status of each remote location reaches ACTIVE, you can set capacity by location using UpdateFleetCapacity .

Learn more

Setting up fleets

Debug fleet creation issues

Multi-location fleets

Related actions

CreateFleet | UpdateFleetCapacity | PutScalingPolicy | DescribeEC2InstanceLimits | DescribeFleetAttributes | DescribeFleetLocationAttributes | UpdateFleetAttributes | StopFleetActions | DeleteFleet | All APIs by task

Request Syntax

{ "BuildId": "string", "CertificateConfiguration": { "CertificateType": "string" }, "Description": "string", "EC2InboundPermissions": [ { "FromPort": number, "IpRange": "string", "Protocol": "string", "ToPort": number } ], "EC2InstanceType": "string", "FleetType": "string", "InstanceRoleArn": "string", "Locations": [ { "Location": "string" } ], "LogPaths": [ "string" ], "MetricGroups": [ "string" ], "Name": "string", "NewGameSessionProtectionPolicy": "string", "PeerVpcAwsAccountId": "string", "PeerVpcId": "string", "ResourceCreationLimitPolicy": { "NewGameSessionsPerCreator": number, "PolicyPeriodInMinutes": number }, "RuntimeConfiguration": { "GameSessionActivationTimeoutSeconds": number, "MaxConcurrentGameSessionActivations": number, "ServerProcesses": [ { "ConcurrentExecutions": number, "LaunchPath": "string", "Parameters": "string" } ] }, "ScriptId": "string", "ServerLaunchParameters": "string", "ServerLaunchPath": "string", "Tags": [ { "Key": "string", "Value": "string" } ] }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

Note

In the following list, the required parameters are described first.

EC2InstanceType

The GameLift-supported Amazon EC2 instance type to use for all fleet instances. 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.

Type: String

Valid Values: t2.micro | t2.small | t2.medium | t2.large | c3.large | c3.xlarge | c3.2xlarge | c3.4xlarge | c3.8xlarge | c4.large | c4.xlarge | c4.2xlarge | c4.4xlarge | c4.8xlarge | c5.large | c5.xlarge | c5.2xlarge | c5.4xlarge | c5.9xlarge | c5.12xlarge | c5.18xlarge | c5.24xlarge | c5a.large | c5a.xlarge | c5a.2xlarge | c5a.4xlarge | c5a.8xlarge | c5a.12xlarge | c5a.16xlarge | c5a.24xlarge | r3.large | r3.xlarge | r3.2xlarge | r3.4xlarge | r3.8xlarge | r4.large | r4.xlarge | r4.2xlarge | r4.4xlarge | r4.8xlarge | r4.16xlarge | r5.large | r5.xlarge | r5.2xlarge | r5.4xlarge | r5.8xlarge | r5.12xlarge | r5.16xlarge | r5.24xlarge | r5a.large | r5a.xlarge | r5a.2xlarge | r5a.4xlarge | r5a.8xlarge | r5a.12xlarge | r5a.16xlarge | r5a.24xlarge | m3.medium | m3.large | m3.xlarge | m3.2xlarge | m4.large | m4.xlarge | m4.2xlarge | m4.4xlarge | m4.10xlarge | m5.large | m5.xlarge | m5.2xlarge | m5.4xlarge | m5.8xlarge | m5.12xlarge | m5.16xlarge | m5.24xlarge | m5a.large | m5a.xlarge | m5a.2xlarge | m5a.4xlarge | m5a.8xlarge | m5a.12xlarge | m5a.16xlarge | m5a.24xlarge

Required: Yes

Name

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

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: Yes

BuildId

The unique identifier for a custom game server build to be deployed on fleet instances. You can use either the build ID or ARN. The build must be uploaded to GameLift and in READY status. This fleet property cannot be changed later.

Type: String

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

Required: No

CertificateConfiguration

Prompts GameLift to generate a TLS/SSL certificate for the fleet. TLS certificates are used for encrypting traffic between game clients and the game servers that are running on GameLift. By default, the CertificateConfiguration is set to DISABLED. This property cannot be changed after the fleet is created.

Note: This feature requires the AWS Certificate Manager (ACM) service, which is not available in all AWS regions. When working in a region that does not support this feature, a fleet creation request with certificate generation fails with a 4xx error.

Type: CertificateConfiguration object

Required: No

Description

A human-readable description of the fleet.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

EC2InboundPermissions

The allowed IP address ranges and port settings that allow inbound traffic to access game sessions on this fleet. If the fleet is hosting a custom game build, this property must be set before players can connect to game sessions. For Realtime Servers fleets, GameLift automatically sets TCP and UDP ranges.

Type: Array of IpPermission objects

Array Members: Maximum number of 50 items.

Required: No

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 property cannot be changed after the fleet is created.

Type: String

Valid Values: ON_DEMAND | SPOT

Required: No

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 property cannot be changed after the fleet is created.

Type: String

Length Constraints: Minimum length of 1.

Required: No

Locations

A set of remote locations to deploy additional instances to and manage as part of the fleet. This parameter can only be used when creating fleets in AWS Regions that support multiple locations. You can add any GameLift-supported AWS Region as a remote location, in the form of an AWS Region code such as us-west-2. To create a fleet with instances in the home Region only, omit this parameter.

Type: Array of LocationConfiguration objects

Array Members: Minimum number of 1 item. Maximum number of 100 items.

Required: No

LogPaths

This parameter is no longer used. To specify where GameLift should store log files once a server process shuts down, use the GameLift server API ProcessReady() and specify one or more directory paths in logParameters. See more information in the Server API Reference.

Type: Array of strings

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

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.

Type: Array of strings

Array Members: Maximum number of 1 item.

Length Constraints: Minimum length of 1. Maximum length of 255.

Required: No

NewGameSessionProtectionPolicy

The status of termination protection for active game sessions on the fleet. By default, this property is set to NoProtection. You can also set game session protection for an individual game session by calling UpdateGameSession .

  • 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.

Type: String

Valid Values: NoProtection | FullProtection

Required: No

PeerVpcAwsAccountId

Used when peering your 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.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

PeerVpcId

A unique identifier for a VPC with resources to be accessed by your 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 GameLift Fleets.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

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.

Type: ResourceCreationLimitPolicy object

Required: No

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.

Type: RuntimeConfiguration object

Required: No

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 GameLift prior to creating the fleet. This fleet property cannot be changed later.

Type: String

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

Required: No

ServerLaunchParameters

This parameter is no longer used. Specify server launch parameters using the RuntimeConfiguration parameter. Requests that use this parameter instead continue to be valid.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Pattern: [A-Za-z0-9_:.+\/\\\- =@;{},?'\[\]"]+

Required: No

ServerLaunchPath

This parameter is no longer used. Specify a server launch path using the RuntimeConfiguration parameter. Requests that use this parameter instead continue to be valid.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Pattern: [A-Za-z0-9_:.+\/\\\- ]+

Required: No

Tags

A list of labels to assign to the new fleet resource. Tags are developer-defined key-value pairs. Tagging AWS resources are useful for resource management, access management and cost allocation. For more information, see Tagging AWS Resources in the AWS General Reference. Once the fleet is created, you can use TagResource , UntagResource , and ListTagsForResource to add, remove, and view tags. The maximum tag limit may be lower than stated. See the AWS General Reference for actual tagging limits.

Type: Array of Tag objects

Array Members: Minimum number of 0 items. Maximum number of 200 items.

Required: No

Response Syntax

{ "FleetAttributes": { "BuildArn": "string", "BuildId": "string", "CertificateConfiguration": { "CertificateType": "string" }, "CreationTime": number, "Description": "string", "FleetArn": "string", "FleetId": "string", "FleetType": "string", "InstanceRoleArn": "string", "InstanceType": "string", "LogPaths": [ "string" ], "MetricGroups": [ "string" ], "Name": "string", "NewGameSessionProtectionPolicy": "string", "OperatingSystem": "string", "ResourceCreationLimitPolicy": { "NewGameSessionsPerCreator": number, "PolicyPeriodInMinutes": number }, "ScriptArn": "string", "ScriptId": "string", "ServerLaunchParameters": "string", "ServerLaunchPath": "string", "Status": "string", "StoppedActions": [ "string" ], "TerminationTime": number }, "LocationStates": [ { "Location": "string", "Status": "string" } ] }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

FleetAttributes

The properties for the new fleet, including the current status. All fleets are placed in NEW status on creation.

Type: FleetAttributes object

LocationStates

The fleet's locations and life-cycle status of each location. For new fleets, the status of all locations is set to NEW. During fleet creation, GameLift updates each location status as instances are deployed there and prepared for game hosting. This list includes an entry for the fleet's home Region. For fleets with no remote locations, only one entry, representing the home Region, is returned.

Type: Array of LocationState objects

Errors

For information about the errors that are common to all actions, see Common Errors.

ConflictException

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

HTTP Status Code: 400

InternalServiceException

The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.

HTTP Status Code: 500

InvalidRequestException

One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.

HTTP Status Code: 400

LimitExceededException

The requested operation would cause the resource to exceed the allowed service limit. Resolve the issue before retrying.

HTTP Status Code: 400

NotFoundException

A service resource associated with the request could not be found. Clients should not retry such requests.

HTTP Status Code: 400

TaggingFailedException

The requested tagging operation did not succeed. This may be due to invalid tag format or the maximum tag limit may have been exceeded. Resolve the issue before retrying.

HTTP Status Code: 400

UnauthorizedException

The client failed authentication. Clients should not retry such requests.

HTTP Status Code: 400

UnsupportedRegionException

The requested operation is not supported in the Region specified.

HTTP Status Code: 400

Examples

Create fleet with minimal configuration (Linux)

This example creates a fleet for a game server build with a minimal configuration and a placeholder launch path. You can use this fleet to create queues and matchmakers, test Amazon Web Services Server API calls, etc. Once you're ready to start hosting game sessions, complete the configuration settings with the UpdateFleet operations. If the fleet is in a Region that supports multiple locations, you can add remote locations with CreateFleetLocations later. Note: this example generates a TLS certificate for the fleet, which can only be enabled during fleet creation.

HTTP requests are authenticated using an AWS Signature Version 4 signature in the Authorization header field.

Sample Request

{ "Name": "My_Fleet_1", "Description": "A minimal sample fleet", "BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "CertificateConfiguration": { "CertificateType": "GENERATED" }, "EC2InstanceType": "c4.large", "FleetType": "ON_DEMAND", "RuntimeConfiguration": { "ServerProcesses": [ {"LaunchPath": "/local/game/mygame.exe", "ConcurrentExecutions": 1} ] } }

Sample Response

{ "FleetAttributes": { "FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "FleetType": "ON_DEMAND", "InstanceType": "c4.large", "Description": "A minimal sample fleet", "Name": "My_Fleet_1", "CreationTime": 1496365885.44, "Status": "NEW", "BuildArn": "arn:aws:gamelift:us-west-2::build/build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "NewGameSessionProtectionPolicy": "NoProtection", "OperatingSystem": "AMAZON_LINUX", "MetricGroups": [ "default" ], "CertificateConfiguration": { "CertificateType": "GENERATED" } } }

Create fleet with minimal configuration (Windows)

This example creates a fleet for a game server build with a minimal configuration and a placeholder launch path. You can use this fleet to create queues and matchmakers, test Amazon Web Services Server API calls, etc. Once you're ready to start hosting game sessions, complete the configuration settings with the UpdateFleet operations. If the fleet is created in a Region that supports multiple locations, you can add remote locations with CreateFleetLocations later.

HTTP requests are authenticated using an AWS Signature Version 4 signature in the Authorization header field.

Sample Request

{ "Name": "My_Fleet_1", "Description": "A minimal sample fleet", "BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "EC2InstanceType": "c4.large", "FleetType": "ON_DEMAND", "RuntimeConfiguration": { "ServerProcesses": [ {"LaunchPath": "c:\\game\\mygame.exe", "ConcurrentExecutions": 1} ] } }

Sample Response

{ "FleetAttributes": { "FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "FleetType": "ON_DEMAND", "InstanceType": "c4.large", "Description": "A minimal sample fleet", "Name": "My_Fleet_1", "CreationTime": 1496365885.44, "Status": "NEW", "BuildArn": "arn:aws:gamelift:us-west-2::build/build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "NewGameSessionProtectionPolicy": "NoProtection", "OperatingSystem": "WINDOWS_2012", "MetricGroups": [ "default" ], "CertificateConfiguration": { "CertificateType": "DISABLED" } } }

Create fleet with full configuration

This example creates a fleet with complete configuration details. The new fleet, which is created in the AWS Region us-west-2, also deploys instances to two remote locations. In this example, the runtime configuration defines two server process configurations. The first configuration calls for three concurrent processes of the game server to run in standard mode. The second configuration calls for one process of the game server to run in a test mode. As a result, all fleet instances will maintain a total of four processes concurrently. This example also references an instance role ARN, which allows the processes running on each instance to access other AWS resources. The example opens port 22 for debugging the fleet. The game server build in this example runs on Windows.

HTTP requests are authenticated using an AWS Signature Version 4 signature in the Authorization header field.

Sample Request

{ "Name": "My_Fleet_1", "Description": "A fully configured sample fleet with", "BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "CertificateConfiguration": { "CertificateType": "GENERATED" }, "EC2InstanceType": "c4.large", "EC2InboundPermissions": [ {"FromPort": 33435, "ToPort": 33435, "IpRange": "10.24.34.0/23", "Protocol": "UDP"}, {"FromPort": 33235, "ToPort": 33235, "IpRange": "10.24.34.0/23", "Protocol": "UDP"}, {"FromPort": 22, "ToPort": 22, "IpRange": "10.24.34.0/23", "Protocol": "TCP"} ], "FleetType": "ON_DEMAND", "Locations": [ {"Location": "us-east-2"}, {"Location": "ca-central-1"} ], "NewGameSessionProtectionPolicy": "FullProtection", "RuntimeConfiguration": { "ServerProcesses": [ {"LaunchPath": "c:\\game\\mygame.exe", "Parameters": "+map Winter444", "ConcurrentExecutions": 3}, {"LaunchPath": "c:\\game\\mygame.exe", "Parameters": "-dev -console +map Winter444", "ConcurrentExecutions": 1} ], "MaxConcurrentGameSessionActivations": 2, "GameSessionActivationTimeoutSeconds": 300 }, "ResourceCreationLimitPolicy": { "NewGameSessionsPerCreator": 3, "PolicyPeriodInMinutes": 15 }, "MetricGroups": ["EMEAfleets"], "InstanceRoleArn": "arn:aws:iam::444455556666:role/S3AccessForGameLift", }

Sample Response

{ "FleetAttributes": { "FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "FleetType": "ON_DEMAND", "InstanceRoleArn": "arn:aws:iam::444455556666:role/S3AccessForGameLift", "Description": "A fully configured sample fleet", "Name": "My_Fleet_One", "CreationTime": 1496375088.502, "Status": "NEW", "BuildArn": "arn:aws:gamelift:us-west-2::build/build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "NewGameSessionProtectionPolicy": "FullProtection", "OperatingSystem": "WINDOWS_2012", "ResourceCreationLimitPolicy": { "NewGameSessionsPerCreator": 3, "PolicyPeriodInMinutes": 15 }, "MetricGroups": [ "EMEAfleets" ], "CertificateConfiguration": { "CertificateType": "GENERATED" } }, "LocationStates": [ { "Location": "us-east-2", "Status": "NEW" }, { "Location": "ca-central-1", "Status": "NEW" } ] }

Create a Realtime Servers fleet

This example creates a fleet using a Realtime script that has been uploaded to Amazon Web Services. All Realtime servers are deployed onto Linux machines. This example represents a simple yet complete fleet configuration. You can change configuration settings with the UpdateRuntimeConfiguration operation. The new fleet, which is created in the AWS Region us-west-2, also deploys instances to two remote locations.

In this example, the uploaded Realtime script includes multiple script files, with the Init() function located in the script file called "myMainScript.js". This file is identified as the launch script in the runtime configuration.

Note

We recommend using a minimal version of the Realtime script when creating your fleets (see this working code example). This will make it much easier to troubleshoot fleet creation issues. After the fleet has reached ACTIVE status, you can update your Realtime script as needed.

Sample Request

{ "Name": "My_Realtime_Fleet_1", "Description": "A complete Realtime sample fleet", "CertificateConfiguration": { "CertificateType": "GENERATED" }, "EC2InstanceType": "c4.large", "FleetType": "SPOT", "Locations": [ {"Location": "us-east-2"}, {"Location": "ca-central-1"} ], "RuntimeConfiguration": { "ServerProcesses": [ {"LaunchPath": "/local/game/myMainScript.js", "Parameters": "+map Winter444", "ConcurrentExecutions": 5} ] }, "ScriptId": "script-1111aaaa-22bb-33cc-44dd-5555eeee66ff" }

Sample Response

{ "FleetAttributes": { "FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "FleetType": "SPOT", "Description": "A complete Realtime sample fleet", "Name": "My_Realtime_Fleet_1", "CreationTime": 1496375088.502, "Status": "NEW", "ScriptArn": "arn:aws:gamelift:us-west-2::script/script-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "ScriptId": "script-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "NewGameSessionProtectionPolicy": "NoProtection", "OperatingSystem": "AMAZON_LINUX", "MetricGroups": [ "default" ], "CertificateConfiguration": { "CertificateType": "GENERATED" } }, "LocationStates": [ { "Location": "us-east-2", "Status": "NEW" }, { "Location": "ca-central-1", "Status": "NEW" } ] }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: