Work with the Amazon GameLift Agent - Amazon GameLift

Work with the Amazon GameLift Agent

The Amazon GameLift Agent oversees the running of game server processes on your Amazon GameLift fleets. The Agent is deployed to each compute in a fleet, and it provides automated process management, hosting management, and logging for the compute. To use the Agent, you must have your game server build integrated with Amazon GameLift server SDK 5.x or later.

The Amazon GameLift Agent is externally available for use with Amazon GameLift fleets that are not managed EC2 fleets. (Managed EC2 fleets handle the Agent's tasks automatically.) You can opt to run Amazon GameLift fleets, including Anywhere fleets, with or without the Agent. Without the Agent, you must provide an alternative solution to completing the required tasks.

When deployed to a compute, the Amazon GameLift Agent should be launched before any game server processes are started. On launch, the Agent completes the following tasks:

  • Registers the compute with an Amazon GameLift Anywhere fleet using the RegisterCompute API.

  • Calls the GetComputeAuthToken API to fetch an authorization token and stores it for use by server processes that are running on the compute.

  • Sets the WebSocket URL environment variable for the compute, and establishes a WebSocket connection to the Amazon GameLift service.

  • Requests the latest version of the fleet's runtime configuration from the Amazon GameLift service.

  • Starts and stops server processes according to the runtime configuration instructions.

Source code and build instructions for the Amazon GameLift Agent are available in the Amazon GameLift Agent GitHub.

About the Agent

The Amazon GameLift Agent is designed to handle the following tasks for your fleets:

Process management

  • Starts new server processes as defined in runtime instructions. The Agent might use a custom runtime configuration that is deployed with the Agent. Alternatively, you can provide a RuntimeConfiguration as part of your fleet definition. This approach has an advantage in that you can modify the fleet's runtime configuration at any time. The Agent periodically requests updated runtime configurations from the Amazon GameLift service.

  • Monitors server process activations and terminates processes when they don't activate in time.

  • Sends heartbeats to Amazon GameLift. If the Agent fails to send heartbeats, the compute might be marked as stale.

  • Reports to Amazon GameLift when a server process ends. Amazon GameLift uses this information to monitor game server availability for game session placement.

  • Emits fleet events for server processes, including:

    • SERVER_PROCESS_INVALID_PATH: The game server process launch parameters were incorrectly configured.

    • SERVER_PROCESS_TERMINATED_UNHEALTHY: The game server process did not report a valid health check within 3 minutes of activating and was therefore terminated.

    • SERVER_PROCESS_FORCE_TERMINATED: The game server process did not exit cleanly after OnProcessTerminate() was sent within 30 seconds.

    • SERVER_PROCESS_CRASHED: A game server process crashed for some reason.

Compute management

  • Receives messages from the Amazon GameLift service to shut down the compute.

  • Prompts the compute to be terminated by Amazon GameLift.

Logging

  • Uploads logs to an Amazon S3 bucket in your AWS account.