Amazon GameLift
Developer Guide (Version )

Create a Fleet

You can create a new fleet to host game servers for any game build that has been uploaded to the Amazon GameLift service and is in a Ready status. Use either the Amazon GameLift console or the AWS Command Line Interface (CLI) to create a fleet. You can change a fleet's configuration by editing a fleet.

Create a Fleet (Console)

To create a fleet with the Amazon GameLift console:

  1. Open the Amazon GameLift console at https://console.aws.amazon.com/gamelift/.

  2. On the Builds page, find the build that you want to create a fleet for and verify that its status is Ready. Select the build (use the option button to the left of the build status) and click Create fleet from build.

  3. On the Create fleet page, enter the Fleet Details:

    • Name – Create a meaningful fleet name so you can easily identify it in a list and in metrics.

    • Description – (Optional) Add a short description for this fleet to further aid identification.

    • Fleet type – Choose whether to use on-demand or spot instances for this fleet. Learn more about fleet types in Choose Computing Resources.

    • Metric group – (Optional) Enter the name of a new or existing fleet metric group. When using Amazon CloudWatch to track your Amazon GameLift metrics, you can aggregate the metrics for multiple fleets by adding them to the same metric group.

    • Build – If you used the Create fleet from build feature, the build information, including name, ID and operating system, is automatically filled in. Otherwise, select a valid build from the dropdown list.

  4. Instance type. Select an Amazon EC2 instance type from the list. The instance types listed vary depending several factors, including the current region, the operating system of the selected game build, and the fleet type (on-demand or spot). Learn more about choosing an instance type in Choose Computing Resources. Once this fleet is created, you cannot change the instance type.

  5. Process management. Configure how you want server processes to run on each instance.

    1. Server process allocation:

      Specify the type and number of game server processes you want to run on each instance. Each fleet must have at least one server process configuration defined and can have multiple configurations. For example, if your game build has multiple server executables, you must have a configuration for each executable.

      • Launch path – Type the path to the game executable in your build. All launch paths must start with the game server location, which varies based on the operating system in use. On Windows instances, game servers are built to the path C:\game. On Linux instances, game servers are built to /local/game, so all launch paths must start with this location. Examples: C:\game\MyGame\server.exe or /local/game/MyGame/server.exe.

      • Launch parameters – (Optional) You can pass information to your game executable at launch time. Type the information as a set of command line parameters here. Example: +sv_port 33435 +start_lobby.

      • Concurrent processes – Indicate how many server processes with this configuration to run concurrently on each instance in the fleet. Check the Amazon GameLift limits on number of concurrent server processes; they depend on which SDK your game server uses.

      Once you enter a server process configuration, click the green checkmark button to save the configuration. To add additional server process configurations, click Add configuration.

      Limits on concurrent server processes per instance apply to the total of concurrent processes for all configurations. If you're limited to one process, you can have only one configuration, and concurrent processes must be set to 1. If you configure the fleet to exceed the limit, the fleet cannot activate.

      The collection of server process configurations is called the fleet's runtime configuration. It describes all server processes that will be running on each instance in this fleet at any given time.

    2. Game session activation:

      Set the following limits to determine how new game sessions are activated on the instances in this fleet:

      • Max concurrent game session activation – Limit the number of game sessions on an instance that can be activating at the same time. This limit is useful when launching multiple new game sessions may have an impact on the performance of other game sessions running on the instance.

      • New activation timeout – This setting limits the amount of time Amazon GameLift allows for a new game session activate. If the game session does not complete activation an move to status ACTIVE, the game session activation is terminated.

  6. EC2 port settings. ClickAdd port settings to define access permissions for inbound traffic connecting to server processes deployed on this fleet. You can create multiple port settings for a fleet. At least one port setting must be set for the fleet before access is allowed. If you don't specify port settings at this time, you can edit the fleet later.

    • Port range – Specify a range of port numbers that your game servers can use to allow inbound connections. A port range must use the format nnnnn[-nnnnn], with values between 1025 and 60000. Example: 1500 or 1500-20000.

    • Protocol – Select the type of communication protocol for the fleet to use.

    • IP address range – Specify a range of IP addresses valid for instances in this fleet. Use CIDR notation. Example: 0.0.0.0/0 (This example allows access to anyone trying to connect.)

  7. In the Resource creation limit section, click Add resource creation limits to set up a policy that limits the number of game sessions any one player can create in a specified period of time. This limit protects your available fleet resources from excessive consumption. To use this feature, requests for new game sessions must specify a creator.

    • Game sessions per policy period – Specify the number of game sessions one player (based on player ID) is allowed to create during the policy period.

    • Policy period – Specify the amount of time, in minutes, over which to limit game session creation per player. Amazon GameLift evaluates each new game session request to determine whether the creator has exceeded the creation limit in the most recent span of time.

  8. In the Protection policy section, choose whether to apply game session protection to instances in this fleet. Instances with protection are not terminated during a scale down event if they are hosting an active game session. You can also set protection for individual game sessions. Once the fleet is created, you can edit the fleet to change the fleet-wide protection policy.

  9. Once you've finished setting the configuration for your new fleet, click Initialize fleet. Amazon GameLift assigns an ID to the new fleet and begins the fleet activation process. You can view the new fleet's status on the Fleets page. Once the fleet is active, you can change the fleet's capacity, runtime configuration, and other configuration settings as needed.

Create a Fleet (AWS CLI)

To create a fleet with the AWS CLI, open a command line window and use the create-fleet command to define a new fleet. See complete documentation on this command in the AWS CLI Command Reference. If you haven't yet installed the AWS CLI, see the topic Install the AWS CLI.

The example create-fleet request shown below creates a new fleet with the following characteristics:

  • The fleet will use c4.large on-demand instances with the operating system required for the selected game build.

  • It will deploy the specified game server build, which must be in a Ready status.

  • Each instance in the fleet will run ten identical processes of the game server concurrently, enabling each instance to host up to ten game sessions simultaneously.

  • On each instance, Amazon GameLift will allow only two new game sessions to be activating at the same time. It will also terminate any activating game session if it is not ready to host players within 300 seconds.

  • All game sessions hosted on instances in this fleet have game session protection turned on. It can be turned off for individual game sessions.

  • Individual players can create three new game sessions within a 15-minute period.

  • Each game sessions hosted on this fleet will have a connection point that falls within the specified IP address and port ranges.

  • Metrics for this fleet will be added to the EMEAfleets metric group, which (in this example) combines metrics for all fleets in EMEA regions.

$ aws gamelift create-fleet --name "SampleFleet123" --description "The sample test fleet" --ec2-instance-type "c4.large" --fleet-type "ON_DEMAND" --build-id "build-92f061ed-27c9-4a02-b1f4-6f85b2385620" --runtime-configuration "GameSessionActivationTimeoutSeconds=300, MaxConcurrentGameSessionActivations=2, ServerProcesses=[{LaunchPath=C:\game\Bin64.dedicated\MultiplayerSampleProjectLauncher_Server.exe, Parameters=+sv_port 33435 +start_lobby, ConcurrentExecutions=10}]" --new-game-session-protection-policy "FullProtection" --resource-creation-limit-policy "NewGameSessionsPerCreator=3, PolicyPeriodInMinutes=15" --ec2-inbound-permissions "FromPort=33435,ToPort=33435,IpRange=0.0.0.0/0,Protocol=UDP" "FromPort=33235,ToPort=33235,IpRange=0.0.0.0/0,Protocol=UDP" --MetricGroups "EMEAfleets"

Copiable version:

aws gamelift create-fleet --name "SampleFleet123" --description "The sample test fleet" --fleet-type "ON_DEMAND" --MetricGroups "EMEAfleets" --build-id "build-92f061ed-27c9-4a02-b1f4-6f85b2385620" --ec2-instance-type "c4.large" --runtime-configuration "GameSessionActivationTimeoutSeconds=300,MaxConcurrentGameSessionActivations=2,ServerProcesses=[{LaunchPath=C:\game\Bin64.dedicated\MultiplayerSampleProjectLauncher_Server.exe,Parameters=+sv_port 33435 +start_lobby,ConcurrentExecutions=10}]" --new-game-session-protection-policy "FullProtection" --resource-creation-limit-policy "NewGameSessionsPerCreator=3,PolicyPeriodInMinutes=15" --ec2-inbound-permissions "FromPort=33435,ToPort=33435,IpRange=0.0.0.0/0,Protocol=UDP" "FromPort=33235,ToPort=33235,IpRange=0.0.0.0/0,Protocol=UDP"

If the create-fleet request is successful, Amazon GameLift returns a set of fleet attributes that includes the configuration settings you requested and a new fleet ID. Amazon GameLift immediately initiates the fleet activation process and sets the fleet status to New. You can track the fleet's status and view other fleet information using these CLI commands:

Once the fleet is active, you can change the fleet's capacity and other configuration settings as needed using these commands:

Create a Fleet and VPC Peering Connection

You can create a new fleet and request a VPC peering connection for the new fleet at the same time. Learn more about Set Up VPC Peering with Amazon GameLift.

Before requesting a peering connection for a new fleet, you must first take the following steps. Both of these are done using the credentials for the account that manages your non-GameLift resources.

  • Create a VPC for a set of resources. The VPC must be in the same region as the fleet you're about to create. Take note of the VPC ID.

  • Call the Amazon GameLift command create-vpc-peering-authorization to pre-authorize the peering request. You'll need the ID of the account that your use with Amazon GameLift. This authorization remains valid for 24 hours unless revoked.

To create a VPC peering connection with your fleet:

  • Follow the instructions for creating a new fleet using the AWS CLI. Include the following additional parameters:

    • peer-vpc-aws-account-id – The ID of your non-GameLift AWS account, for which you've created a VPC.

    • peer-vpc-id – The ID of the VPC created with your non-GameLift account.

A successful call to create-fleet with the VPC peering parameters generates both a new fleet and a new VPC peering request. The fleet's status is set to New and the fleet activation process is initiated. The peering request's status is set to initiating-request. You can track the success or failure of the peering request by calling describe-vpc-peering-connections.

When requesting a VPC peering connection with a new fleet, both actions either succeed or fail. If a fleet fails during the creation process, the VPC peering connection will not complete successfully. Likewise, if a VPC peering connection fails for any reason, the new fleet will fail to move from status Activating to Active.

Note

The new VPC peering connection is not completed until the fleet is ready to become active. As a result, it is not available during installation of the game server build on a new fleet instance.

The following example shows a request to create both a new fleet and a peering connection between a pre-established VPC and the VPC that is created for the new fleet. The pre-established VPC is uniquely identified by the combination of your non-GameLift AWS account ID and the VPC ID.

$ aws gamelift create-fleet --name "My_Fleet_1" --description "The sample test fleet" --ec2-instance-type "c4.large" --fleet-type "ON_DEMAND" --build-id "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff" --runtime-configuration "GameSessionActivationTimeoutSeconds=300, MaxConcurrentGameSessionActivations=2, ServerProcesses=[{LaunchPath=C:\game\Bin64.dedicated\MultiplayerSampleProjectLauncher_Server.exe, Parameters=+sv_port 33435 +start_lobby, ConcurrentExecutions=10}]" --new-game-session-protection-policy "FullProtection" --resource-creation-limit-policy "NewGameSessionsPerCreator=3, PolicyPeriodInMinutes=15" --ec2-inbound-permissions "FromPort=33435,ToPort=33435,IpRange=0.0.0.0/0,Protocol=UDP" "FromPort=33235,ToPort=33235,IpRange=0.0.0.0/0,Protocol=UDP" --MetricGroups "EMEAfleets" --peer-vpc-aws-account-id "111122223333" --peer-vpc-id "vpc-a11a11a"

Copyable version:

aws gamelift create-fleet --name "My_Fleet_1" --description "The sample test fleet" --fleet-type "ON_DEMAND" --MetricGroups "EMEAfleets" --build-id "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff" --ec2-instance-type "c4.large" --runtime-configuration "GameSessionActivationTimeoutSeconds=300,MaxConcurrentGameSessionActivations=2,ServerProcesses=[{LaunchPath=C:\game\Bin64.dedicated\MultiplayerSampleProjectLauncher_Server.exe,Parameters=+sv_port 33435 +start_lobby,ConcurrentExecutions=10}]" --new-game-session-protection-policy "FullProtection" --resource-creation-limit-policy "NewGameSessionsPerCreator=3,PolicyPeriodInMinutes=15" --ec2-inbound-permissions "FromPort=33435,ToPort=33435,IpRange=0.0.0.0/0,Protocol=UDP" "FromPort=33235,ToPort=33235,IpRange=0.0.0.0/0,Protocol=UDP" --peer-vpc-aws-account-id "111122223333" --peer-vpc-id "vpc-a11a11a"