Amazon GameLift Service
API Reference (API Version 2015-10-01)

CreateFleet

Creates a new fleet to run your game servers. whether they are custom game builds or Realtime Servers with game-specific script. A fleet is a set of Amazon Elastic Compute Cloud (Amazon EC2) instances, each of which can host multiple game sessions. When creating a fleet, you choose the hardware specifications, set some configuration options, and specify the game server to deploy on the new fleet.

To create a new fleet, you must provide the following: (1) a fleet name, (2) an EC2 instance type and fleet type (spot or on-demand), (3) the build ID for your game build or script ID if using Realtime Servers, and (4) a run-time configuration, which determines how game servers will run on each instance in the fleet.

Note

When creating a Realtime Servers fleet, we recommend using a minimal version of the Realtime script (see this working code example ). This will make it much easier to troubleshoot any fleet creation issues. Once the fleet is active, you can update your Realtime script as needed.

If the CreateFleet call is successful, Amazon GameLift performs the following tasks. You can track the process of a fleet by checking the fleet status or by monitoring fleet creation events:

  • Creates a fleet record. Status: NEW.

  • Begins writing events to the fleet event log, which can be accessed in the Amazon GameLift console.

    Sets the fleet's target capacity to 1 (desired instances), which triggers Amazon GameLift to start one new EC2 instance.

  • Downloads the game build or Realtime script to the new instance and installs it. Statuses: DOWNLOADING, VALIDATING, BUILDING.

  • Starts launching server processes on the instance. If the fleet is configured to run multiple server processes per instance, Amazon GameLift staggers each launch by a few seconds. Status: ACTIVATING.

  • Sets the fleet's status to ACTIVE as soon as one server process is ready to host a game session.

Learn more

Working with Fleets

Debug Fleet Creation Issues

Related operations

Request Syntax

{ "BuildId": "string", "Description": "string", "EC2InboundPermissions": [ { "FromPort": number, "IpRange": "string", "Protocol": "string", "ToPort": number } ], "EC2InstanceType": "string", "FleetType": "string", "InstanceRoleArn": "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" }

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

Name of an EC2 instance type that is supported in Amazon GameLift. A fleet instance type determines the computing resources of each instance in the fleet, including CPU, memory, storage, and networking capacity. Amazon GameLift supports the following EC2 instance types. See Amazon EC2 Instance Types for detailed descriptions.

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 | r3.large | r3.xlarge | r3.2xlarge | r3.4xlarge | r3.8xlarge | r4.large | r4.xlarge | r4.2xlarge | r4.4xlarge | r4.8xlarge | r4.16xlarge | m3.medium | m3.large | m3.xlarge | m3.2xlarge | m4.large | m4.xlarge | m4.2xlarge | m4.4xlarge | m4.10xlarge

Required: Yes

Name

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

Unique identifier for a build to be deployed on the new fleet. The custom game server 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.

Type: String

Pattern: ^build-\S+

Required: No

Description

Human-readable description of a fleet.

Type: String

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

Required: No

EC2InboundPermissions

Range of IP addresses and port settings that permit inbound traffic to access game sessions that running on the fleet. For fleets using a custom game build, this parameter is required before game sessions running on the fleet can accept connections. For Realtime Servers fleets, Amazon GameLift automatically sets TCP and UDP ranges for use by the Realtime servers. You can specify multiple permission settings or add more by updating the fleet.

Type: Array of IpPermission objects

Array Members: Maximum number of 50 items.

Required: No

FleetType

Indicates whether to use on-demand instances or spot instances for this fleet. If empty, the default is ON_DEMAND. Both categories of instances use identical hardware and configurations based on the instance type selected for this fleet. Learn more about On-Demand versus Spot Instances.

Type: String

Valid Values: ON_DEMAND | SPOT

Required: No

InstanceRoleArn

Unique identifier for an AWS 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, daemons (background processes). Create a role or look up a role's ARN 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.

Type: String

Length Constraints: Minimum length of 1.

Required: No

LogPaths

This parameter is no longer used. Instead, to specify where Amazon GameLift should store log files once a server process shuts down, use the Amazon 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

Name of an Amazon CloudWatch metric group to add this fleet to. A metric group aggregates the metrics for all fleets in the group. Specify an existing metric group name, or provide a new name to create a new metric group. A fleet can only be included in 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

Game session protection policy to apply to all instances in this fleet. If this parameter is not set, instances in this fleet default to no protection. You can change a fleet's protection policy using UpdateFleetAttributes, but this change will only affect sessions created after the policy change. You can also set protection for individual instances using UpdateGameSession.

  • NoProtection -- The game session can be terminated during a scale-down event.

  • FullProtection -- If the game session is in an ACTIVE status, it cannot be terminated during a scale-down event.

Type: String

Valid Values: NoProtection | FullProtection

Required: No

PeerVpcAwsAccountId

Unique identifier for the AWS account with the VPC that you want to peer your Amazon GameLift fleet with. 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

Unique identifier for a VPC with resources to be accessed by your Amazon GameLift fleet. The VPC must be in the same region where your fleet is deployed. Look up a VPC ID using the VPC Dashboard in the AWS Management Console. Learn more about VPC peering in VPC Peering with Amazon GameLift Fleets.

Type: String

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

Required: No

ResourceCreationLimitPolicy

Policy that limits the number of game sessions an individual player can create over a span of time for this fleet.

Type: ResourceCreationLimitPolicy object

Required: No

RuntimeConfiguration

Instructions for launching server processes on each instance in the fleet. Server processes run either a custom game build executable or a Realtime Servers script. The run-time configuration lists the types of server processes to run on an instance and includes the following configuration settings: the server executable or launch script file, launch parameters, and the number of processes to run concurrently on each instance. A CreateFleet request must include a run-time configuration with at least one server process configuration.

Type: RuntimeConfiguration object

Required: No

ScriptId

Unique identifier for a Realtime script to be deployed on the new fleet. The Realtime script must have been successfully uploaded to Amazon GameLift. This fleet setting cannot be changed once the fleet is created.

Type: String

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

Required: No

ServerLaunchParameters

This parameter is no longer used. Instead, specify server launch parameters in the RuntimeConfiguration parameter. (Requests that specify a server launch path and launch parameters instead of a run-time configuration will continue to work.)

Type: String

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

Required: No

ServerLaunchPath

This parameter is no longer used. Instead, specify a server launch path using the RuntimeConfiguration parameter. (Requests that specify a server launch path and launch parameters instead of a run-time configuration will continue to work.)

Type: String

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

Required: No

Response Syntax

{ "FleetAttributes": { "BuildId": "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 }, "ScriptId": "string", "ServerLaunchParameters": "string", "ServerLaunchPath": "string", "Status": "string", "StoppedActions": [ "string" ], "TerminationTime": number } }

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

Properties for the newly created fleet.

Type: FleetAttributes object

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

UnauthorizedException

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

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 GameLift Server API calls, etc. Once you're ready to start hosting game sessions, complete the configuration settings with the UpdateFleet operations.

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

Sample Request

POST / HTTP/1.1 Host: gamelift.us-west-2.amazonaws.com; Accept-Encoding: identity Content-Length: 338 User-Agent: aws-cli/1.11.36 Python/2.7.9 Windows/7 botocore/1.4.93 Content-Type: application/x-amz-json-1.0 Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20170406/us-west-2/gamelift/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY X-Amz-Date: 20170406T004805Z X-Amz-Target: GameLift.CreateFleet { "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": "/local/game/mygame.exe", "ConcurrentExecutions": 1} ] } } CLI syntax: $aws gamelift create-fleet --name My_Fleet_2 --description "Another minimal sample fleet" --build-id build-1111aaaa-22bb-33cc-44dd-5555eeee66ff --ec2-instance-type "c4.large" --fleet-type "ON_DEMAND" --runtime-configuration "ServerProcesses=[{LaunchPath=/local/game/mygame.exe,ConcurrentExecutions=1}]"

Sample Response

HTTP/1.1 200 OK x-amzn-RequestId: b34f8665-EXAMPLE Content-Type: application/x-amz-json-1.1 Content-Length: 607 Date: Thu, 06 Apr 2017 00:48:07 GMT { "FleetAttributes": { "Status": "NEW", "FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "Name": "My_Fleet_1", "NewGameSessionProtectionPolicy": "NoProtection", "BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "CreationTime": 1496365885.44, "MetricGroups": ["default"], "InstanceType": "c4.large", "ServerLaunchPath": "/local/game/mygame.exe", "FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "OperatingSystem": "AMAZON_LINUX", "FleetType": "ON_DEMAND", "Description": "A minimal sample fleet" } }

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 GameLift Server API calls, etc. Once you're ready to start hosting game sessions, complete the configuration settings with the UpdateFleet operations.

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

Sample Request

POST / HTTP/1.1 Host: gamelift.us-west-2.amazonaws.com; Accept-Encoding: identity Content-Length: 336 User-Agent: aws-cli/1.11.36 Python/2.7.9 Windows/7 botocore/1.4.93 Content-Type: application/x-amz-json-1.0 Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20170406/us-west-2/gamelift/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY X-Amz-Date: 20170406T004805Z X-Amz-Target: GameLift.CreateFleet { "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} ] } } CLI syntax: $aws gamelift create-fleet --name My_Fleet_2 --description "Another minimal sample fleet" --build-id build-1111aaaa-22bb-33cc-44dd-5555eeee66ff --ec2-instance-type "c4.large" --fleet-type "ON_DEMAND" --runtime-configuration "ServerProcesses=[{LaunchPath=c:\game\mygame.exe,ConcurrentExecutions=1}]"

Sample Response

HTTP/1.1 200 OK x-amzn-RequestId: b34f8665-EXAMPLE Content-Type: application/x-amz-json-1.1 Content-Length: 600 Date: Thu, 06 Apr 2017 00:48:07 GMT { "FleetAttributes": { "Status": "NEW", "FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "Name": "My_Fleet_1", "NewGameSessionProtectionPolicy": "NoProtection", "BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "CreationTime": 1496365885.44, "MetricGroups": ["default"], "InstanceType": "c4.large", "ServerLaunchPath": "c:\\game\\mygame.exe", "FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "OperatingSystem": "WINDOWS_2012", "FleetType": "ON_DEMAND", "Description": "A minimal sample fleet" } }

Create fleet with full configuration

This example creates a new fleet with complete configuration details. In this example, the runtime configuration sets up two different 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, each instance in this fleet is configured to run four processes of the game server concurrently. This example also requests that a VPC peering connection be established between the VPC for this new fleet and another VPC that has been pre-authorized. The game server build in this example is Windows.

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

Sample Request

POST / HTTP/1.1 Host: gamelift.us-west-2.amazonaws.com; Accept-Encoding: identity Content-Length: 1249 User-Agent: aws-cli/1.11.36 Python/2.7.9 Windows/7 botocore/1.4.93 Content-Type: application/x-amz-json-1.0 Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20170406/us-west-2/gamelift/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY X-Amz-Date: 20170406T004805Z X-Amz-Target: GameLift.CreateFleet { "Name": "My_Fleet_1", "Description": "A fully configured sample fleet", "BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "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"} ], "FleetType": "ON_DEMAND", "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", "PeerVpcAwsAccountId": "444455556666", "PeerVpcId": "vpc-a11a11a1" } CLI syntax: $aws gamelift create-fleet --name "My_Fleet_2" --description "Another fully configured sample fleet" --build-id "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff" --ec2-instance-type "c4.large" --ec2-inbound-permissions "FromPort=33435,ToPort=33435,IpRange=10.24.34.0/23,Protocol=UDP" --fleet-type "ON_DEMAND" --new-game-session-protection-policy "FullProtection" --runtime-configuration "GameSessionActivationTimeoutSeconds=300, MaxConcurrentGameSessionActivations=2, ServerProcesses=[ {LaunchPath=c:\game\mygame.exe,Parameters=+map Winter444,ConcurrentExecutions=1}, {LaunchPath=c:\game\mygame.exe,Parameters=-dev -console -sw +sv_lan 1 +sv_cheats 1 +port 33235 +map Winter444,ConcurrentExecutions=1} ]" --resource-creation-limit-policy "NewGameSessionsPerCreator=3,PolicyPeriodInMinutes=15" --metric-groups "EMEAfleets" -\-instance-role-arn "arn:aws:iam::444455556666:role/S3AccessForGameLift" --peer-vpc-aws-account-id "444455556666" --peer-vpc-id "vpc-f12bf994"

Sample Response

HTTP/1.1 200 OK x-amzn-RequestId: b34f8665-EXAMPLE Content-Type: application/x-amz-json-1.1 Content-Length: 699 Date: Thu, 06 Apr 2017 00:48:07 GMT { "FleetAttributes": { "BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "CreationTime": 1496375088.502, "Description": "A fully configured sample fleet", "FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "FleetType": "ON_DEMAND", "InstanceRoleArn": "arn:aws:iam::444455556666:role/S3AccessForGameLift", "MetricGroups": ["EMEAfleets"], "Name": "My_Fleet_One", "NewGameSessionProtectionPolicy": "FullProtection", "OperatingSystem": "WINDOWS_2012", "ResourceCreationLimitPolicy": { "NewGameSessionsPerCreator": 3, "PolicyPeriodInMinutes": 15}, "Status": "NEW" } }

Create a Realtime Servers fleet

This example creates a fleet using a Realtime script that has been uploaded to Amazon GameLift. 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 action.

For the purposes of this example, assume that the uploaded Realtime script includes multiple script files, with the Init() function located in the script file called "myMainScript.js". As shown, his file is identified as the launch script in the runtime configuration.

Sample Request

POST /2015-03-31/functions HTTP/1.1 Content-type: application/json { "Name": "My_Realtime_Fleet_1", "Description": "A complete Realtime sample fleet", "ScriptId": "script-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "EC2InstanceType": "c4.large", "FleetType": "SPOT", "RuntimeConfiguration": { "ServerProcesses": [ {"LaunchPath": "/local/game/myMainScript.js", "Parameters": "+map Winter444", "ConcurrentExecutions": 5} ] } } CLI: $aws gamelift create-fleet --name "My_Realtime_Fleet_1" --description "A complete Realtime sample fleet" --script-id "script-1111aaaa-22bb-33cc-44dd-5555eeee66ff" --ec2-instance-type "c4.large" --fleet-type "SPOT" --runtime-configuration "ServerProcesses=[ {LaunchPath=/local/game/myMainScript.js,Parameters=+map Winter444,ConcurrentExecutions=5}]"

Sample Response

HTTP/1.1 200 OK x-amzn-RequestId: b34f8665-EXAMPLE Content-Type: application/x-amz-json-1.1 Content-Length: 699 Date: Thu, 06 Apr 2017 00:48:07 GMT { "FleetAttributes": { "ScriptId": "script-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "CreationTime": 1496375088.502, "Description": "A complete Realtime sample fleet", "FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "FleetType": "SPOT", "MetricGroups": ["default"], "Name": "My_Realtime_Fleet_1", "NewGameSessionProtectionPolicy": "NoProtection", "OperatingSystem": "AMAZON_LINUX", "Status": "NEW" } }

See Also

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