Migrate to Amazon GameLift server SDK 5.x - Amazon GameLift

Migrate to Amazon GameLift server SDK 5.x

To update a game project to use server SDK version 5.x, make the following changes:

  1. Get the latest Amazon GameLift Server SDK package for your development environment [Download site]. Follow the install instructions in the Readme file for your downloaded package and version. See these instructions for using the server SDKs with your game project.

  2. Update your server code as follows:

    • Change the server code callback function onCreateGameSession() to onStartGameSession().

    • Update the InitSDK() inputs as appropriate:

      • If you plan to deploy the game server build to either an Amazon GameLift managed EC2 fleet or an Anywhere fleet with the Amazon GameLift Agent:

        Call InitSDK() with no parameters (C++) (C#) (Unreal). This call sets up the compute environment and a WebSocket connection to the Amazon GameLift service.

      • If you plan to deploy the game server build to an Anywhere fleet without the Amazon GameLift Agent:

        Call InitSDK() with server parameters (C++) (C#) (Unreal). A game server process uses these parameters to establish a connection with the Amazon GameLift service.

  3. If your game server build or other hosted applications communicate with other AWS resources while running, you'll need to change how the application gets access to those resources. Replace the use of AssumeRoleCredentials with the new Amazon GameLift server SDK action GetFleetRoleCredentials() (for game servers) or use shared credentials (for other applications). For more on how to implement this change, see Communicate with other AWS resources from your fleets.

  4. If your project called the server SDK action GetInstanceCertificate() to retrieve a TLS certificate, modify your code to use the new GetComputeCertificate() (C++) (C#) (Unreal) instead.

  5. When uploading your game build to Amazon GameLift (such as with upload-build or CreateBuild()), set the ServerSdkVersion parameter to the 5.x version you're using (this parameter currently defaults to 4.0.2). This parameter must match the actual server SDK libraries in the game server build. If you specify the wrong version for an uploaded game server build, any fleets you create with that build will fail. See Deploy a custom server build for Amazon GameLift hosting.

    The following example illustrates how to specify the server SDK version:

    aws gamelift upload-build \ --operating-system AMAZON_LINUX_2023 \ --server-sdk-version "5.0.0" \ --build-root "~/mygame" \ --name "My Game Nightly Build" \ --build-version "build 255" \ --region us-west-2
  6. If you use scripts to remotely connect to managed fleets, update the scripts to use the new process, as described in Remotely connect to Amazon GameLift fleet instances.