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

CreateFleet

Creates a new fleet to run your game servers. A fleet is a set of Amazon Elastic Compute Cloud (Amazon EC2) instances, each of which can run multiple server processes to host game sessions. You configure a fleet to create instances with certain hardware specifications (see Amazon EC2 Instance Types for more information), and deploy a specified game build to each instance. A newly created fleet passes through several statuses; once it reaches the ACTIVE status, it can begin hosting game sessions.

To create a new fleet, you must specify the following: (1) fleet name, (2) build ID of an uploaded game build, (3) an EC2 instance type, and (4) a run-time configuration that describes which server processes to run on each instance in the fleet. (Although the run-time configuration is not a required parameter, the fleet cannot be successfully activated without it.)

You can also configure the new fleet with the following settings:

  • Fleet description

  • Access permissions for inbound traffic

  • Fleet-wide game session protection

  • Resource creation limit

If you use Amazon CloudWatch for metrics, you can add the new fleet to a metric group. This allows you to view aggregated metrics for a set of fleets. Once you specify a metric group, the new fleet's metrics are included in the metric group's data.

You have the option of creating a VPC peering connection with the new fleet. For more information, see VPC Peering with Amazon GameLift Fleets.

If the CreateFleet call is successful, Amazon GameLift performs the following tasks:

  • Creates a fleet record and sets the status to NEW (followed by other statuses as the fleet is activated).

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

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

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

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

Fleet-related operations include:

Request Syntax

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

BuildId

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

Type: String

Pattern: ^build-\S+

Required: Yes

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

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 server processes running on the fleet. If no inbound permissions are set, including both IP address range and port range, the server processes in the fleet cannot accept connections. You can specify one or more sets of permissions for a fleet.

Type: Array of IpPermission objects

Array Members: Maximum number of 50 items.

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 a metric group to add this fleet to. A metric group tracks metrics across all fleets in the group. Use an existing metric group name to add this fleet to the group, or use 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. To get VPC information, including IDs, use the Virtual Private Cloud service tools, including the VPC Dashboard in the AWS Management Console.

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. The run-time configuration for a fleet has a collection of server process configurations, one for each type of server process to run on an instance. A server process configuration specifies the location of the server executable, launch parameters, and the number of concurrent processes with that configuration to maintain on each instance. A CreateFleet request must include a run-time configuration with at least one server process configuration; otherwise the request fails with an invalid request exception. (This parameter replaces the parameters ServerLaunchPath and ServerLaunchParameters; requests that contain values for these parameters instead of a run-time configuration will continue to work.)

Type: RuntimeConfiguration object

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",
      "LogPaths": [ "string" ],
      "MetricGroups": [ "string" ],
      "Name": "string",
      "NewGameSessionProtectionPolicy": "string",
      "OperatingSystem": "string",
      "ResourceCreationLimitPolicy": { 
         "NewGameSessionsPerCreator": number,
         "PolicyPeriodInMinutes": number
      },
      "ServerLaunchParameters": "string",
      "ServerLaunchPath": "string",
      "Status": "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",
    "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" 
--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": {
        "BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", 
        "CreationTime": 1496365885.44, 
        "Description": "A minimal sample fleet", 
        "FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", 
        "FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", 
        "MetricGroups": ["default"],
        "Name": "My_Fleet_1", 
        "NewGameSessionProtectionPolicy": "NoProtection", 
        "OperatingSystem": "AMAZON_LINUX", 
        "ServerLaunchPath": "/local/game/mygame.exe", 
        "Status": "NEW"
    }
}

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",
    "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" 
--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": {
        "BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", 
        "CreationTime": 1496365885.44, 
        "Description": "A minimal sample fleet", 
        "FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", 
        "FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", 
        "MetricGroups": ["default"],
        "Name": "My_Fleet_1", 
        "NewGameSessionProtectionPolicy": "NoProtection", 
        "OperatingSystem": "WINDOWS_2012", 
        "ServerLaunchPath": "c:\\game\\mygame.exe", 
        "Status": "NEW"}
}

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"}
    ],
    "NewGameSessionProtectionPolicy": "FullProtection",
    "RuntimeConfiguration": {
        "ServerProcesses": [
            {"LaunchPath": "c:\\game\\mygame.exe",
             "Parameters": "+map Winter444",
             "ConcurrentExecutions": 3}, 
            {"LaunchPath": "c:\\game\\mygame.exe",
             "Parameters": "-dev -console -sw +sv_lan 1 +sv_cheats 1 +port 33235 +map Winter444",
             "ConcurrentExecutions": 1}
        ],
        "MaxConcurrentGameSessionActivations": 2,
        "GameSessionActivationTimeoutSeconds": 300
    },
    "ResourceCreationLimitPolicy": {
        "NewGameSessionsPerCreator": 3,
        "PolicyPeriodInMinutes": 15
    },
    "MetricGroups": ["EMEAfleets"],
    "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"
  --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" 
  --peer-vpc-aws-account-id "401680102694" 
  --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", 
        "MetricGroups": ["EMEAfleets"], 
        "Name": "My_Fleet_One", 
        "NewGameSessionProtectionPolicy": "FullProtection", 
        "OperatingSystem": "WINDOWS_2012", 
        "ResourceCreationLimitPolicy": {
            "NewGameSessionsPerCreator": 3, 
            "PolicyPeriodInMinutes": 15}, 
        "Status": "NEW"
    }
}

See Also

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