Create an Amazon GameLift managed EC2 fleet
This topic describes how to create an Amazon GameLift managed EC2 fleet. Managed fleets use Amazon Elastic Compute Cloud (Amazon EC2) compute instances that are optimized for multiplayer game hosting. You can create managed fleets that deploy computes to globally to Amazon Web Services Regions and Local Zones supported by Amazon GameLift.
When you create a new managed EC2 fleet, the fleet creation process starts immediately. A
managed fleet passes through several phases as Amazon GameLift prepares your game server build,
deploys EC2 instances with your build installed, and launches game servers on each instance.
You can monitor a fleet's status in the console or using the uring Amazon Command Line Interface (Amazon CLI). A
fleet is ready to host game sessions when its status reaches ACTIVE
. For more
information about managed fleet creation, see the following topics:
To create a managed EC2 fleet
Use either the Amazon GameLift console or the Amazon Command Line Interface (Amazon CLI) to create a managed EC2 fleet.
- Console
-
To create a managed EC2 fleet
-
In the Amazon GameLift console
, in the navigation pane, choose Fleets. -
On the Fleets page, choose Create fleet.
-
Choose Managed EC2.
-
On the Fleet details page do the following:
-
For Name, enter a fleet name. We recommend including the fleet type (Spot or On-demand) in your fleet names. This makes it much easier to identify fleet types when viewing a list of fleets.
-
For Description, provide a short description of the fleet.
-
For Binary type, select Build or Script to define the game server type that Amazon GameLift deploys to this fleet.
-
Select a Script or Build from the dropdown list of uploaded scripts or builds.
-
-
(Optional) Under Additional details for the following:
-
For Instance role, specify an IAM role that authorizes applications in your game build to access other Amazon resources in your account. For more information, see Communicate with other Amazon resources from your fleets. To create a fleet with an instance role, your account must have the IAM
PassRole
permission. For more information, see IAM permission examples for Amazon GameLift.You can't update these settings after fleet creation.
-
For Metric group, Enter the name of a new or existing fleet metric group. You can aggregate the metrics for multiple fleets by adding them to the same metric group.
You can't update the metric group after fleet creation.
-
-
Choose Next.
-
On the Select locations page, select one or more additional remote locations to deploy instances to. The home Region is automatically selected based on the Region you are accessing the console from. If you select additional locations, fleet instances are also deployed in these locations.
Important
To use Regions that aren't enabled by default, enable them in your Amazon Web Services account.
Fleets with Regions that aren't enabled that you created before February 28, 2022 are unaffected.
To create new multi-location fleets or to update existing multi-location fleets, first enable any Regions that you choose to use.
For more information about Regions that aren't enabled by default and how to enable them, see Managing Amazon Web Services Regions in the Amazon Web Services General Reference.
-
Choose Next.
-
On the Define instance details page, choose
On-demand or Spot instances for this fleet. For more information about fleet types, see On-Demand Instances versus Spot Instances.
From the Filter architecture menu choose x64 or Arm.
Note
Graviton Arm instances require an Amazon GameLift server build on Linux OS. Server SDK 5.1.1 or newer is required for C++ and C#. Server SDK 5.0 or newer is required for Go. These instances provide no out-of-the-box support for Mono installation on Amazon Linux 2023 (AL2023) or Amazon Linux 2 (AL2).
For information on Amazon EC2 Arm architectures, see Amazon Graviton Processor
and Amazon EC2 instance types .
For information on the instance types supported by Amazon GameLift, see the
EC2InstanceType
values under CreateFleet() request parameters. -
Select an Amazon EC2 Instance type from the list. For more information about choosing an instance type, see Instance types. After you create the fleet, you can't change the instance type.
-
Choose Next.
-
On the Configure runtime page, under Runtime configuration do the following:
-
For Launch path, enter the path to the game executable in your build or script. On Windows instances, game servers are built to the path
C:\game
. On Linux instances, game servers are built to/local/game
. Examples:C:\game\MyGame\server.exe
,/local/game/MyGame/server.exe
, orMyRealtimeLaunchScript.js
. -
(Optional) For Launch parameters, enter information to pass to your game executable as a set of command line parameters. Example:
+sv_port 33435 +start_lobby
. -
For Concurrent processes, choose the number of server processes to run concurrently on each instance in the fleet. Review the Amazon GameLift limits
on number of concurrent server processes. Limits on concurrent server processes per instance apply to the total of concurrent processes for all configurations. If you configure the fleet to exceed the limit, the fleet can't activate.
-
-
Under Game session activation, provide limits for activating new game sessions on the instances in this fleet:
-
For Max concurrent game session activation, enter the number of game sessions on an instance that activate 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.
-
For New activation timeout, enter how long to wait for a session to activate. If the game session doesn't move to
ACTIVE
status before the timeout, Amazon GameLift terminates the game session activation.
-
-
(Optional) Under EC2 port settings, do the following:
-
Choose Add port setting to define access permissions for inbound traffic connecting to the server process deployed on the fleet.
-
For Type, choose Custom TCP or Custom UDP.
-
For Port range, Enter a range of port numbers that allow inbound connections. A port range must use the format
nnnnn[-nnnnn]
, with values between 1026 and 60000. Example:1500
or1500-20000
. -
For IP address range, Enter a range of IP addresses. Use CIDR notation. Example:
0.0.0.0/0
(This example allows access to anyone trying to connect.)
-
-
(Optional) Under Game session resource settings do the following:
-
For Game scaling protection policy, Turn on or off scaling protection. Amazon GameLift won't terminate instance with protection during a scale down event if they're hosting an active game session.
-
For Resource creation limit, enter a maximum number of game sessions a player can create during the policy period.
-
-
Choose Next.
-
(Optional) Add tags to the build by entering Key and Value pairs. Choose Next to continue to fleet creation review.
-
Choose Create. Amazon GameLift assigns an ID to the new fleet and begins the fleet activation process. You can track the new fleet's status on the Fleets page.
You can update the fleet's metadata and configuration at any time, regardless of fleet status. For more information, see Update an Amazon GameLift fleet configuration. You can update fleet capacity after the fleet has reached ACTIVE status. For more information, see Scaling game hosting capacity with Amazon GameLift. You can also add or remove remote locations.
-
- Amazon CLI
-
Use the
create-fleet
command to create a fleet of compute type EC2
. Amazon GameLift creates the fleet resource in your current default Amazon Web Services Region (or you can add a --region tag to specify a different Amazon Web Services Region).Create a minimal managed fleet
The following example request creates a new fleet with the minimal settings that are required to deploy a fleet with running game servers that game clients can connect to. The new fleet has these characteristics:
-
It specifies a game server build, which has been uploaded to Amazon GameLift and in
READY
status. -
Is uses c5.large On-Demand Instances with an operating system that matches the selected game build.
-
It sets the fleet's home Amazon Web Services Region to
us-west-2
and deploys instances to that Region only. -
Based on the runtime configuration, each compute in the fleet runs one game server process, which means that each compute can host only one game session at a time. Game session activation timeout is set to the default value of 300 seconds, and there's no limit on the number of concurrent activations.
-
Players can connect to game servers using a single port setting of
33435
. -
All other features are either turned off or use default settings.
aws gamelift create-fleet \ --name MinimalFleet123 \ --description "A basic test fleet" \ --region us-west-2 \ --ec2-instance-type c5.large \ --fleet-type ON_DEMAND \ --build-id build-1111aaaa-22bb-33cc-44dd-5555eeee66ff \ --runtime-configuration "ServerProcesses=[{LaunchPath=C:\game\Bin64.dedicated\MultiplayerSampleProjectLauncher_Server.exe, ConcurrentExecutions=10}]" \ --ec2-inbound-permissions "FromPort=33435,ToPort=33435,IpRange=0.0.0.0/0,Protocol=UDP"
Create a fully configured managed fleet
The following example request creates a production fleet with settings for all optional features. The new fleet has these characteristics:
-
It specifies a game server build, which has been uploaded to Amazon GameLift and in
READY
status. -
It uses c5.large On-Demand Instances with the operating system that matches the selected game build.
-
It sets the fleet's home Amazon Web Services Region to
us-west-2
and deploys instances to the home Region and one remote locationsa-east-1
. -
Based on the runtime configuration:
-
Each compute in the fleet runs 10 game server processes with the same launch parameters, which means that each compute can host up to 10 game sessions simultaneously.
-
On each compute, only two game sessions can be activating at the same time. Activating game sessions must be ready to host players within 300 seconds (5 minutes) or be terminated.
-
-
Players can connect to game servers using a port in the following range
33435 to 33535
. -
All game sessions in the fleet have game session protection turned on.
-
Individual players are limited to creating three new game sessions within a 15-minute period.
-
Metrics for this fleet are included in the metric group
AMERfleets
, which (for this example) aggregates metrics for a group of fleets in North, Central, and South America.
aws gamelift create-fleet \ --name ProdFleet123 \ --description "A fully configured prod fleet" \ --ec2-instance-type c5.large \ --region us-west-2 \ --locations "Location=sa-east-1" \ --fleet-type ON_DEMAND \ --build-id build-1111aaaa-22bb-33cc-44dd-5555eeee66ff \ --certificate-configuration "CertificateType=GENERATED" \ --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=33535,IpRange=0.0.0.0/0,Protocol=UDP" \ --metric-groups "AMERfleets"
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 then initiates the fleet activation process and sets the fleet status and the location statuses to New. You can track the fleet's status and view other fleet information using these CLI commands:
You can change the fleet's capacity and other configuration settings as needed using these commands:
-