Create an Amazon GameLift Servers Anywhere fleet
This topic describes how to create an Amazon GameLift Servers Anywhere fleet. With an Anywhere fleet, you can use core Amazon GameLift Servers game session management features while hosting game sessions with your own compute resources. Create an Anywhere fleet for your on-premises hardware or other cloud-based resources.
Anywhere fleets are commonly used alongside Amazon GameLift Servers managed fleets in a hybrid hosting solution. They also provide useful test environments when developing a game for hosting with Amazon GameLift Servers. See these topics to learn more about when and how to incorporate Amazon GameLift Servers Anywhere fleets into a game hosting solution:
Because Anywhere fleets are self-managed, setting up a fleet requires some additional work. To get an Anywhere fleet ready to host game sessions and players, you need to complete the following tasks:
Topics
Before you start
Before creating an Anywhere fleet, do the following tasks. For more detailed guidance, see the Development roadmap for hosting with Amazon GameLift Servers Anywhere or Development roadmap for hybrid hosting with Amazon GameLift Servers.
-
Integrate your game server code with the Amazon GameLift Servers server SDK version 5.x (or higher). You don't need to complete all game integration tasks, just those required for a game server build. A common practice is to set up your local machine as an Anywhere fleet and use a command line interface to test your game server integration (see Set up local testing with Amazon GameLift Servers Anywhere). You can incorporate additional components (such as an Amazon GameLift Servers enabled game client) as your develop them.
-
Package your game server software for installation onto your Anywhere fleet computes. The package should include your integrated game server build and all support software needed to run your game server.
-
Decide whether to use the Amazon GameLift Servers Agent with your Anywhere fleet. The Agent is an on-compute process management tool that automates some of the key tasks related to managing server processes and computes for use with Amazon GameLift Servers. For more information, see Work with the Amazon GameLift Servers Agent.
Create a custom location
Create a custom location to represent the physical location of your compute resources. When creating an Anywhere fleet, you must have at least one custom location already defined. You can create additional custom locations and add them to an existing fleet at any time.
To create a custom location
Use either the Amazon GameLift Servers console or the AWS Command Line Interface (AWS CLI) to create a custom location.
Create an Anywhere fleet
Create an Anywhere fleet for a set of compute resources that you own. A new Anywhere fleet starts empty; you add computes to the fleet by registering them.
On creation, a new Anywhere fleet quickly moves through fleet statuses from
NEW
to ACTIVE
. You can add computes to the fleet after it
reaches ACTIVE
.
To create an Anywhere fleet
Use either the Amazon GameLift Servers console or the AWS Command Line Interface (AWS CLI) to create an Anywhere fleet.
Add a compute to the fleet
To add a compute resource to a fleet and get it ready to host game sessions, do the following tasks:
-
Register the compute with the fleet. Registration tells Amazon GameLift Servers what physical hosting resources are part of the fleet.
-
Request an authentication token for the compute. Each game server that runs on the compute needs this token to connect to the Amazon GameLift Servers service. Authentication tokens are temporary and must be regularly refreshed.
Note
If you're deploying your game server software with the Amazon GameLift Servers Agent, you can skip this step. The Agent automatically registers each compute and maintains a valid authentication token for the compute. See Work with the Amazon GameLift Servers Agent.
You can register a compute and request an authentication token by using the AWS CLI or making programmatic calls to the AWS SDK for Amazon GameLift Servers. These actions are not available through the Amazon GameLift Servers console.
As a best practice, we recommend automating both of these tasks by adding a startup
script to each compute. The startup script automatically calls both the
register-compute
and get-compute-auth-token
commands. You
can also automate tasks to regularly refresh the auth token throughout the life of the
compute and deregister the compute on shut down.
Each of the startup actions returns compute-specific values that you need to store on the compute. When a game server process launches on the compute, it must pass these values as server parameters when initializing a connection with the Amazon GameLift Servers service (see ServerParameters in the server SDK reference). We recommend that you set these compute-specific values (or their stored locations) as environment variables. If you're using the Amazon GameLift Servers Agent, this task is handled for you. The compute-specific values are as follows:
-
register-compute
returns a value forGameLiftServiceSdkEndpoint
. Set this value to thewebSocketUrl
server parameter. -
compute-auth-token
returns the authentication token. Set this value to theauthToken
server parameter.
Start a game server
After you've created an Anywhere fleet and added one or more computes to the fleet, you're ready to start running your game servers.
- Step 1 Install your game server software
Get your game server build and all dependent software installed onto each compute in your Anywhere fleet. The game server build must be integrated with Amazon GameLift Servers server SDK version 5.x (or higher) with the minimum required functionality to communicate with the Amazon GameLift Servers service.
- Step 2 Get your computes ready to run a game server
-
Ensure that each compute is registered and has a valid authentication token. If you're using scripts to manage these tasks, make sure that the scripts run on each compute before starting any game server processes.
If you've deployed the Amazon GameLift Servers Agent with your game server software, make sure that the Agent executable launches.
- Step 3 Launch a game server process
Run an instance of your game server executable on a compute. If your game server build is properly integrated, the game server process calls the server SDK action
InitSDK()
with a set of valid server parameters. When the server process is ready to host a game session, it callsProcessReady()
.Note
If you deployed your game server software with the Amazon GameLift Servers Agent, you can skip this step. The Agent automatically launches game server processes based on the runtime instructions you provide.
You can monitor progress by viewing server process metrics for activating and active server processes. See Amazon GameLift Servers metrics for fleets. If your game server process fails to initialize, verify that the process is retrieving the right server parameter values for the compute it's running on.