CreateFleet - Amazon GameLift

CreateFleet

Creates a fleet of Amazon Elastic Compute Cloud (Amazon EC2) 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 Amazon 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 Amazon 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 Amazon 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 Amazon 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.

When the fleet status changes to ACTIVE, you can enable automatic scaling 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

Request Syntax

{ "AnywhereConfiguration": { "Cost": "string" }, "BuildId": "string", "CertificateConfiguration": { "CertificateType": "string" }, "ComputeType": "string", "Description": "string", "EC2InboundPermissions": [ { "FromPort": number, "IpRange": "string", "Protocol": "string", "ToPort": number } ], "EC2InstanceType": "string", "FleetType": "string", "InstanceRoleArn": "string", "InstanceRoleCredentialsProvider": "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.

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

AnywhereConfiguration

Amazon GameLift Anywhere configuration options.

Type: AnywhereConfiguration object

Required: No

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 Amazon GameLift and in READY status. This fleet property can't be changed after the fleet is created.

Type: String

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

Required: No

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.

Type: CertificateConfiguration object

Required: No

ComputeType

The type of compute resource used to host your game servers. You can use your own compute resources with Amazon GameLift Anywhere or use Amazon EC2 instances with managed Amazon GameLift. By default, this property is set to EC2.

Type: String

Valid Values: EC2 | ANYWHERE

Required: No

Description

A description for 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, Amazon GameLift automatically sets TCP and UDP ranges.

Type: Array of IpPermission objects

Array Members: Maximum number of 50 items.

Required: No

EC2InstanceType

The Amazon 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 | c5d.large | c5d.xlarge | c5d.2xlarge | c5d.4xlarge | c5d.9xlarge | c5d.12xlarge | c5d.18xlarge | c5d.24xlarge | c6a.large | c6a.xlarge | c6a.2xlarge | c6a.4xlarge | c6a.8xlarge | c6a.12xlarge | c6a.16xlarge | c6a.24xlarge | c6i.large | c6i.xlarge | c6i.2xlarge | c6i.4xlarge | c6i.8xlarge | c6i.12xlarge | c6i.16xlarge | c6i.24xlarge | r5d.large | r5d.xlarge | r5d.2xlarge | r5d.4xlarge | r5d.8xlarge | r5d.12xlarge | r5d.16xlarge | r5d.24xlarge | m6g.medium | m6g.large | m6g.xlarge | m6g.2xlarge | m6g.4xlarge | m6g.8xlarge | m6g.12xlarge | m6g.16xlarge | c6g.medium | c6g.large | c6g.xlarge | c6g.2xlarge | c6g.4xlarge | c6g.8xlarge | c6g.12xlarge | c6g.16xlarge | r6g.medium | r6g.large | r6g.xlarge | r6g.2xlarge | r6g.4xlarge | r6g.8xlarge | r6g.12xlarge | r6g.16xlarge | c6gn.medium | c6gn.large | c6gn.xlarge | c6gn.2xlarge | c6gn.4xlarge | c6gn.8xlarge | c6gn.12xlarge | c6gn.16xlarge | c7g.medium | c7g.large | c7g.xlarge | c7g.2xlarge | c7g.4xlarge | c7g.8xlarge | c7g.12xlarge | c7g.16xlarge | r7g.medium | r7g.large | r7g.xlarge | r7g.2xlarge | r7g.4xlarge | r7g.8xlarge | r7g.12xlarge | r7g.16xlarge | m7g.medium | m7g.large | m7g.xlarge | m7g.2xlarge | m7g.4xlarge | m7g.8xlarge | m7g.12xlarge | m7g.16xlarge | g5g.xlarge | g5g.2xlarge | g5g.4xlarge | g5g.8xlarge | g5g.16xlarge

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

Type: String

Valid Values: ON_DEMAND | SPOT

Required: No

InstanceRoleArn

A unique identifier for an IAM role with access permissions to other AWS services. Any application that runs on an instance in the fleet--including install scripts, server processes, and other processes--can use these permissions to interact with AWS resources that you own or have access to. For more information about using the role with your game server builds, see Communicate with other AWS resources from your fleets. This fleet property can't be changed after the fleet is created.

Type: String

Length Constraints: Minimum length of 1.

Required: No

InstanceRoleCredentialsProvider

Prompts Amazon GameLift to generate a shared credentials file for the IAM role defined in InstanceRoleArn. The shared credentials file is stored on each fleet instance and refreshed as needed. Use shared credentials for applications that are deployed along with the game server executable, if the game server is integrated with server SDK version 5.x. For more information about using shared credentials, see Communicate with other AWS resources from your fleets.

Type: String

Valid Values: SHARED_CREDENTIAL_FILE

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 Amazon 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, don't use this parameter.

To use this parameter, Amazon GameLift requires you to use your home location in the request.

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 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. For more information, see Initialize the server process in the Amazon GameLift Developer Guide.

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

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

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 Amazon GameLift prior to creating the fleet. This fleet property can't be changed after the fleet is created.

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.

Type: Array of Tag objects

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

Required: No

Response Syntax

{ "FleetAttributes": { "AnywhereConfiguration": { "Cost": "string" }, "BuildArn": "string", "BuildId": "string", "CertificateConfiguration": { "CertificateType": "string" }, "ComputeType": "string", "CreationTime": number, "Description": "string", "FleetArn": "string", "FleetId": "string", "FleetType": "string", "InstanceRoleArn": "string", "InstanceRoleCredentialsProvider": "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, Amazon 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

The requested resources was not found. The resource was either not created yet or deleted.

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 GameLift 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_2023", "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 GameLift 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_2016", "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_2016", "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 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 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_2023", "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: